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

Side by Side Diff: pkg/serialization/lib/src/serialization_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: Add return type for values() 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
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): We should have an example and tests for subclassing 7 // TODO(alanknight): We should have an example and tests for subclassing
8 // serialization rule rather than using the hard-coded ClosureToMap rule. And 8 // serialization rule rather than using the hard-coded ClosureToMap rule. And
9 // possibly an abstract superclass that's designed to be subclassed that way. 9 // possibly an abstract superclass that's designed to be subclassed that way.
10 /** 10 /**
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 operator [](x) => _reader.inflateReference(_raw[x]); 528 operator [](x) => _reader.inflateReference(_raw[x]);
529 529
530 int get length => _raw.length; 530 int get length => _raw.length;
531 bool get isEmpty => _raw.isEmpty; 531 bool get isEmpty => _raw.isEmpty;
532 bool get isNotEmpty => _raw.isNotEmpty; 532 bool get isNotEmpty => _raw.isNotEmpty;
533 Iterable get keys => _raw.keys; 533 Iterable get keys => _raw.keys;
534 bool containsKey(x) => _raw.containsKey(x); 534 bool containsKey(x) => _raw.containsKey(x);
535 535
536 // These operations will work, but may be expensive, and are probably 536 // These operations will work, but may be expensive, and are probably
537 // best avoided. 537 // best avoided.
538 get _inflated => keysAndValues(_raw).map(_reader.inflateReference); 538 get _inflated => mapValues(_raw, _reader.inflateReference);
539 bool containsValue(x) => _inflated.containsValue(x); 539 bool containsValue(x) => _inflated.containsValue(x);
540 Iterable get values => _inflated.values; 540 Iterable get values => _inflated.values;
541 void forEach(f) => _inflated.forEach(f); 541 void forEach(f) => _inflated.forEach(f);
542 542
543 // These operations are all invalid 543 // These operations are all invalid
544 _throw() { 544 _throw() {
545 throw new UnsupportedError("Not modifiable"); 545 throw new UnsupportedError("Not modifiable");
546 } 546 }
547 operator []=(x, y) => _throw(); 547 operator []=(x, y) => _throw();
548 putIfAbsent(x, y) => _throw(); 548 putIfAbsent(x, y) => _throw();
(...skipping 19 matching lines...) Expand all
568 int get length => _raw.length; 568 int get length => _raw.length;
569 569
570 void set length(int value) => _throw(); 570 void set length(int value) => _throw();
571 571
572 void operator []=(int index, value) => _throw(); 572 void operator []=(int index, value) => _throw();
573 573
574 void _throw() { 574 void _throw() {
575 throw new UnsupportedError("Not modifiable"); 575 throw new UnsupportedError("Not modifiable");
576 } 576 }
577 } 577 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698