| 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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 _LazyMap(this._raw, this._reader); | 509 _LazyMap(this._raw, this._reader); |
| 510 | 510 |
| 511 Map _raw; | 511 Map _raw; |
| 512 Reader _reader; | 512 Reader _reader; |
| 513 | 513 |
| 514 // This is the only operation that really matters. | 514 // This is the only operation that really matters. |
| 515 operator [](x) => _reader.inflateReference(_raw[x]); | 515 operator [](x) => _reader.inflateReference(_raw[x]); |
| 516 | 516 |
| 517 int get length => _raw.length; | 517 int get length => _raw.length; |
| 518 bool get isEmpty => _raw.isEmpty; | 518 bool get isEmpty => _raw.isEmpty; |
| 519 List get keys => _raw.keys; | 519 Iterable get keys => _raw.keys; |
| 520 bool containsKey(x) => _raw.containsKey(x); | 520 bool containsKey(x) => _raw.containsKey(x); |
| 521 | 521 |
| 522 // These operations will work, but may be expensive, and are probably | 522 // These operations will work, but may be expensive, and are probably |
| 523 // best avoided. | 523 // best avoided. |
| 524 get _inflated => keysAndValues(_raw).map(_reader.inflateReference); | 524 get _inflated => keysAndValues(_raw).map(_reader.inflateReference); |
| 525 bool containsValue(x) => _inflated.containsValue(x); | 525 bool containsValue(x) => _inflated.containsValue(x); |
| 526 List get values => _inflated.values; | 526 Iterable get values => _inflated.values; |
| 527 void forEach(f) => _inflated.forEach(f); | 527 void forEach(f) => _inflated.forEach(f); |
| 528 | 528 |
| 529 // These operations are all invalid | 529 // These operations are all invalid |
| 530 _throw() => throw new UnsupportedError("Not modifiable"); | 530 _throw() => throw new UnsupportedError("Not modifiable"); |
| 531 operator []=(x, y) => _throw(); | 531 operator []=(x, y) => _throw(); |
| 532 putIfAbsent(x, y) => _throw(); | 532 putIfAbsent(x, y) => _throw(); |
| 533 remove(x) => _throw(); | 533 remove(x) => _throw(); |
| 534 clear() => _throw(); | 534 clear() => _throw(); |
| 535 } | 535 } |
| OLD | NEW |