| 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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 void invalidate() { | 518 void invalidate() { |
| 519 _contents = null; | 519 _contents = null; |
| 520 contents; | 520 contents; |
| 521 } | 521 } |
| 522 | 522 |
| 523 Iterator<_Field> get iterator => contents.iterator; | 523 Iterator<_Field> get iterator => contents.iterator; |
| 524 | 524 |
| 525 /** Return a cached, sorted list of all the fields. */ | 525 /** Return a cached, sorted list of all the fields. */ |
| 526 List<_Field> get contents { | 526 List<_Field> get contents { |
| 527 if (_contents == null) { | 527 if (_contents == null) { |
| 528 _contents = sorted(allFields.values); | 528 _contents = allFields.values.toList()..sort(); |
| 529 for (var i = 0; i < _contents.length; i++) | 529 for (var i = 0; i < _contents.length; i++) |
| 530 _contents[i].index = i; | 530 _contents[i].index = i; |
| 531 } | 531 } |
| 532 return _contents; | 532 return _contents; |
| 533 } | 533 } |
| 534 | 534 |
| 535 /** Iterate over the regular fields, i.e. those not used in the constructor.*/ | 535 /** Iterate over the regular fields, i.e. those not used in the constructor.*/ |
| 536 void forEachRegularField(Function f) { | 536 void forEachRegularField(Function f) { |
| 537 for (var each in contents) { | 537 for (var each in contents) { |
| 538 if (each.isRegular) { | 538 if (each.isRegular) { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 if (value is String) { | 670 if (value is String) { |
| 671 try { | 671 try { |
| 672 return new Symbol(value); | 672 return new Symbol(value); |
| 673 } on ArgumentError { | 673 } on ArgumentError { |
| 674 return null; | 674 return null; |
| 675 }; | 675 }; |
| 676 } else { | 676 } else { |
| 677 return null; | 677 return null; |
| 678 } | 678 } |
| 679 } | 679 } |
| OLD | NEW |