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): 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 // This is the only operation that really matters. | 472 // This is the only operation that really matters. |
473 operator [](x) => _reader.inflateReference(_raw[x]); | 473 operator [](x) => _reader.inflateReference(_raw[x]); |
474 | 474 |
475 int get length => _raw.length; | 475 int get length => _raw.length; |
476 bool get isEmpty => _raw.isEmpty; | 476 bool get isEmpty => _raw.isEmpty; |
477 Iterable get keys => _raw.keys; | 477 Iterable get keys => _raw.keys; |
478 bool containsKey(x) => _raw.containsKey(x); | 478 bool containsKey(x) => _raw.containsKey(x); |
479 | 479 |
480 // These operations will work, but may be expensive, and are probably | 480 // These operations will work, but may be expensive, and are probably |
481 // best avoided. | 481 // best avoided. |
482 get _inflated => keysAndValues(_raw).map(_reader.inflateReference); | 482 get _inflated => keysAndValues(_raw).mappedBy(_reader.inflateReference); |
483 bool containsValue(x) => _inflated.containsValue(x); | 483 bool containsValue(x) => _inflated.containsValue(x); |
484 Iterable get values => _inflated.values; | 484 Iterable get values => _inflated.values; |
485 void forEach(f) => _inflated.forEach(f); | 485 void forEach(f) => _inflated.forEach(f); |
486 | 486 |
487 // These operations are all invalid | 487 // These operations are all invalid |
488 _throw() { | 488 _throw() { |
489 throw new UnsupportedError("Not modifiable"); | 489 throw new UnsupportedError("Not modifiable"); |
490 } | 490 } |
491 operator []=(x, y) => _throw(); | 491 operator []=(x, y) => _throw(); |
492 putIfAbsent(x, y) => _throw(); | 492 putIfAbsent(x, y) => _throw(); |
(...skipping 18 matching lines...) Expand all Loading... |
511 operator [](x) => _reader.inflateReference(_raw[x]); | 511 operator [](x) => _reader.inflateReference(_raw[x]); |
512 | 512 |
513 int get length => _raw.length; | 513 int get length => _raw.length; |
514 bool get isEmpty => _raw.isEmpty; | 514 bool get isEmpty => _raw.isEmpty; |
515 get first => _reader.inflateReference(_raw.first); | 515 get first => _reader.inflateReference(_raw.first); |
516 get last => _reader.inflateReference(_raw.last); | 516 get last => _reader.inflateReference(_raw.last); |
517 | 517 |
518 // These operations, and other inherited methods that iterate over the whole | 518 // These operations, and other inherited methods that iterate over the whole |
519 // list will work, but may be expensive, and are probably | 519 // list will work, but may be expensive, and are probably |
520 // best avoided. | 520 // best avoided. |
521 List get _inflated => _raw.map(_reader.inflateReference); | 521 List get _inflated => _raw.mappedBy(_reader.inflateReference); |
522 Iterator get iterator => _inflated.iterator; | 522 Iterator get iterator => _inflated.iterator; |
523 indexOf(x, [pos = 0]) => _inflated.toList().indexOf(x); | 523 indexOf(x, [pos = 0]) => _inflated.toList().indexOf(x); |
524 lastIndexOf(x, [pos]) => _inflated.toList().lastIndexOf(x); | 524 lastIndexOf(x, [pos]) => _inflated.toList().lastIndexOf(x); |
525 | 525 |
526 // These operations are all invalid | 526 // These operations are all invalid |
527 _throw() { | 527 _throw() { |
528 throw new UnsupportedError("Not modifiable"); | 528 throw new UnsupportedError("Not modifiable"); |
529 } | 529 } |
530 operator []=(x, y) => _throw(); | 530 operator []=(x, y) => _throw(); |
531 add(x) => _throw(); | 531 add(x) => _throw(); |
532 addLast(x) => _throw(); | 532 addLast(x) => _throw(); |
533 addAll(x) => _throw(); | 533 addAll(x) => _throw(); |
534 sort([f]) => _throw(); | 534 sort([f]) => _throw(); |
535 clear() => _throw(); | 535 clear() => _throw(); |
536 removeAt(x) => _throw(); | 536 removeAt(x) => _throw(); |
537 remove(x) => _throw(); | 537 remove(x) => _throw(); |
538 removeLast() => _throw(); | 538 removeLast() => _throw(); |
539 removeAll(x) => _throw(); | 539 removeAll(x) => _throw(); |
540 retainAll(x) => _throw(); | 540 retainAll(x) => _throw(); |
541 removeMatching(x) => _throw(); | 541 removeMatching(x) => _throw(); |
542 retainMatching(x) => _throw(); | 542 retainMatching(x) => _throw(); |
543 getRange(x, y) => _throw(); | 543 getRange(x, y) => _throw(); |
544 setRange(x, y, z, [a]) => _throw(); | 544 setRange(x, y, z, [a]) => _throw(); |
545 removeRange(x, y) => _throw(); | 545 removeRange(x, y) => _throw(); |
546 insertRange(x, y, [z]) => _throw(); | 546 insertRange(x, y, [z]) => _throw(); |
547 get reversed => _throw(); | 547 get reversed => _throw(); |
548 void set length(x) => _throw(); | 548 void set length(x) => _throw(); |
549 } | 549 } |
OLD | NEW |