Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: pkg/serialization/lib/src/basic_rule.dart

Issue 24582004: Get rid of several old collection workarounds in serialization (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes from review Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/serialization/lib/src/reader_writer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | pkg/serialization/lib/src/reader_writer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698