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

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

Issue 214723002: Remove unmodifiable map wrappers that could instead use UnmodifiableMapView. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix missing import, increment mirror function count. 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.
15 abstract class AbstractMap<K, V> implements Map<K, V> { 17 abstract class AbstractMap<K, V> implements Map<K, V> {
16 AbstractMap(); 18 AbstractMap();
17 19
18 AbstractMap.from(Map<K, V> other) { 20 AbstractMap.from(Map<K, V> other) {
19 other.forEach((k,v) => this[k] = v); 21 other.forEach((k,v) => this[k] = v);
20 } 22 }
21 23
22 void operator []=(K key, value) { 24 void operator []=(K key, value) {
23 throw new UnsupportedError('[]= is not supported'); 25 throw new UnsupportedError('[]= is not supported');
24 } 26 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 175
174 void forEach(void f(K key, Vout value)) { 176 void forEach(void f(K key, Vout value)) {
175 _map.forEach((K k, Vin v) { 177 _map.forEach((K k, Vin v) {
176 var value = _filter(v); 178 var value = _filter(v);
177 if (value != null) { 179 if (value != null) {
178 f(k, value); 180 f(k, value);
179 } 181 }
180 }); 182 });
181 } 183 }
182 } 184 }
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