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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/mirrors/util.dart

Issue 246833003: Revert "Remove unmodifiable map wrappers that could instead use UnmodifiableMapView." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | « runtime/lib/mirrors_impl.dart ('k') | sdk/lib/_internal/lib/js_mirrors.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 library dart2js.mirrors.util; 5 library dart2js.mirrors.util;
6 6
7 import 'dart:collection' show Maps; 7 import 'dart:collection' show Maps;
8 8
9 /** 9 /**
10 * An abstract map implementation. This class can be used as a superclass for 10 * An abstract map implementation. This class can be used as a superclass for
11 * implementing maps, requiring only the further implementation of the 11 * implementing maps, requiring only the further implementation of the
12 * [:operator []:], [:forEach:] and [:length:] methods to provide a fully 12 * [:operator []:], [:forEach:] and [:length:] methods to provide a fully
13 * implemented immutable map. 13 * implemented immutable map.
14 */ 14 */
15 // TODO(lrn): Consider using UnmodifiableBaseMap/UnmodifiableMapWrapper
16 // for these classes, or just rewrite for a bit more efficiency.
17 abstract class AbstractMap<K, V> implements Map<K, V> { 15 abstract class AbstractMap<K, V> implements Map<K, V> {
18 AbstractMap(); 16 AbstractMap();
19 17
20 AbstractMap.from(Map<K, V> other) { 18 AbstractMap.from(Map<K, V> other) {
21 other.forEach((k,v) => this[k] = v); 19 other.forEach((k,v) => this[k] = v);
22 } 20 }
23 21
24 void operator []=(K key, value) { 22 void operator []=(K key, value) {
25 throw new UnsupportedError('[]= is not supported'); 23 throw new UnsupportedError('[]= is not supported');
26 } 24 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 173
176 void forEach(void f(K key, Vout value)) { 174 void forEach(void f(K key, Vout value)) {
177 _map.forEach((K k, Vin v) { 175 _map.forEach((K k, Vin v) {
178 var value = _filter(v); 176 var value = _filter(v);
179 if (value != null) { 177 if (value != null) {
180 f(k, value); 178 f(k, value);
181 } 179 }
182 }); 180 });
183 } 181 }
184 } 182 }
OLDNEW
« no previous file with comments | « runtime/lib/mirrors_impl.dart ('k') | sdk/lib/_internal/lib/js_mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698