Chromium Code Reviews| Index: sdk/lib/collection/maps.dart |
| diff --git a/sdk/lib/collection/maps.dart b/sdk/lib/collection/maps.dart |
| index 7945e7ea643411074c5e65769a5870c0733913c7..8d68b5e4651a9497d863645bec66c401d15e5c78 100644 |
| --- a/sdk/lib/collection/maps.dart |
| +++ b/sdk/lib/collection/maps.dart |
| @@ -208,8 +208,21 @@ class MapView<K, V> implements Map<K, V> { |
| * the constructor, except for operations that modify the map. |
| * Modifying operations throw instead. |
| */ |
| -class UnmodifiableMapView<K, V> = |
| - MapView<K, V> with _UnmodifiableMapMixin<K, V>; |
| +class UnmodifiableMapView<K, V> extends MapView<K, V> |
| + with _UnmodifiableMapMixin<K, V> { |
| + /** |
| + * Returns a view of [source] that's guaranteed to be unmodifiable. |
| + * |
| + * If [source] already extends [UnmodifiableMapBase] or [UnmodifiableMapView], |
| + * this avoids re-wrapping it. |
|
Lasse Reichstein Nielsen
2015/08/27 07:59:04
Also say that it returns the original object unwra
nweiz
2015/08/27 19:25:37
Done.
|
| + */ |
| + static Map ensure(Map source) => |
|
Lasse Reichstein Nielsen
2015/08/27 07:59:04
Move below constructor, and also don't like name h
nweiz
2015/08/27 19:25:37
Done.
|
| + source is _UnmodifiableMapMixin || source is ImmutableMap |
|
Lasse Reichstein Nielsen
2015/08/27 07:59:04
What is ImmutableMap?
It looks like the VM's cons
nweiz
2015/08/27 19:25:37
Yes, this was intended to handle constant maps. I
|
| + ? source |
| + : new UnmodifiableMapView(source); |
| + |
| + UnmodifiableMapView(Map<K, V> map) : super(map); |
| +} |
| /** |
| * Helper class which implements complex [Map] operations |