OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of serialization; | 5 part of serialization; |
6 | 6 |
7 /** | 7 /** |
8 * This writes out the state of the objects to an external format. It holds | 8 * This writes out the state of the objects to an external format. It holds |
9 * all of the intermediate state needed. The primary API for it is the | 9 * all of the intermediate state needed. The primary API for it is the |
10 * [write] method. | 10 * [write] method. |
(...skipping 20 matching lines...) Expand all Loading... |
31 */ | 31 */ |
32 bool selfDescribing; | 32 bool selfDescribing; |
33 | 33 |
34 /** | 34 /** |
35 * Objects that cannot be represented in-place in the serialized form need | 35 * Objects that cannot be represented in-place in the serialized form need |
36 * to have references to them stored. The [Reference] objects are computed | 36 * to have references to them stored. The [Reference] objects are computed |
37 * once and stored here for each object. This provides some space-saving, | 37 * once and stored here for each object. This provides some space-saving, |
38 * but also serves to record which objects we have already seen. | 38 * but also serves to record which objects we have already seen. |
39 */ | 39 */ |
40 final Map<Object, Reference> references = | 40 final Map<Object, Reference> references = |
41 new IdentityMapPlus<Object, Reference>(); | 41 new IdentityMap<Object, Reference>(); |
42 | 42 |
43 /** | 43 /** |
44 * The state of objects that need to be serialized is stored here. | 44 * The state of objects that need to be serialized is stored here. |
45 * Each rule has a number, and rules keep track of the objects that they | 45 * Each rule has a number, and rules keep track of the objects that they |
46 * serialize, in order. So the state of any object can be found by indexing | 46 * serialize, in order. So the state of any object can be found by indexing |
47 * from the rule number and the object number within the rule. | 47 * from the rule number and the object number within the rule. |
48 * The actual representation of the state is determined by the rule. Lists | 48 * The actual representation of the state is determined by the rule. Lists |
49 * and Maps are common, but it is arbitrary. | 49 * and Maps are common, but it is arbitrary. |
50 */ | 50 */ |
51 final List<List> states = new List<List>(); | 51 final List<List> states = new List<List>(); |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 */ | 647 */ |
648 class DesignatedRuleForObject { | 648 class DesignatedRuleForObject { |
649 Function rulePredicate; | 649 Function rulePredicate; |
650 final target; | 650 final target; |
651 | 651 |
652 DesignatedRuleForObject(this.target, this.rulePredicate); | 652 DesignatedRuleForObject(this.target, this.rulePredicate); |
653 | 653 |
654 possibleRules(List rules) => rules.filter(rulePredicate); | 654 possibleRules(List rules) => rules.filter(rulePredicate); |
655 } | 655 } |
656 | 656 |
OLD | NEW |