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 // TODO(alanknight): Figure out how to reasonably separate out the things | 7 // TODO(alanknight): Figure out how to reasonably separate out the things |
8 // that require reflection without making the API more awkward. Or if that is | 8 // that require reflection without making the API more awkward. Or if that is |
9 // in fact necessary. Maybe the tree-shaking will just remove it if unused. | 9 // in fact necessary. Maybe the tree-shaking will just remove it if unused. |
10 | 10 |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 * use the value for that. | 412 * use the value for that. |
413 */ | 413 */ |
414 get name => value; | 414 get name => value; |
415 } | 415 } |
416 | 416 |
417 /** | 417 /** |
418 * The organization of fields in an object can be reasonably complex, so they | 418 * The organization of fields in an object can be reasonably complex, so they |
419 * are kept in a separate object, which also has the ability to compute the | 419 * are kept in a separate object, which also has the ability to compute the |
420 * default fields to use reflectively. | 420 * default fields to use reflectively. |
421 */ | 421 */ |
422 class _FieldList extends Iterable { | 422 class _FieldList extends IterableBase { |
423 /** | 423 /** |
424 * All of our fields, indexed by name. Note that the names are not | 424 * All of our fields, indexed by name. Note that the names are not |
425 * necessarily strings. | 425 * necessarily strings. |
426 */ | 426 */ |
427 Map<dynamic, _Field> allFields = new Map<dynamic, _Field>(); | 427 Map<dynamic, _Field> allFields = new Map<dynamic, _Field>(); |
428 | 428 |
429 /** | 429 /** |
430 * The fields which are used in the constructor. The fields themselves also | 430 * The fields which are used in the constructor. The fields themselves also |
431 * know if they are constructor fields or not, but we need to keep this | 431 * know if they are constructor fields or not, but we need to keep this |
432 * information here because the order matters. | 432 * information here because the order matters. |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 _MapWrapper(this.fieldList) : _map = new Map(); | 630 _MapWrapper(this.fieldList) : _map = new Map(); |
631 _MapWrapper.fromMap(this._map, this.fieldList); | 631 _MapWrapper.fromMap(this._map, this.fieldList); |
632 | 632 |
633 operator [](key) => _map[fieldList[key].name]; | 633 operator [](key) => _map[fieldList[key].name]; |
634 | 634 |
635 operator []=(key, value) { _map[fieldList[key].name] = value; } | 635 operator []=(key, value) { _map[fieldList[key].name] = value; } |
636 get length => _map.length; | 636 get length => _map.length; |
637 | 637 |
638 asMap() => _map; | 638 asMap() => _map; |
639 } | 639 } |
OLD | NEW |