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

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

Issue 12086062: Rename mappedBy to map. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
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 part of _js_helper; 5 part of _js_helper;
6 6
7 // This class has no constructor. This is on purpose since the instantiation 7 // This class has no constructor. This is on purpose since the instantiation
8 // is shortcut by the compiler. 8 // is shortcut by the compiler.
9 class ConstantMap<V> implements Map<String, V> { 9 class ConstantMap<V> implements Map<String, V> {
10 final int length; 10 final int length;
(...skipping 17 matching lines...) Expand all
28 28
29 void forEach(void f(String key, V value)) { 29 void forEach(void f(String key, V value)) {
30 _keys.forEach((String key) => f(key, this[key])); 30 _keys.forEach((String key) => f(key, this[key]));
31 } 31 }
32 32
33 Iterable<String> get keys { 33 Iterable<String> get keys {
34 return new _ConstantMapKeyIterable(this); 34 return new _ConstantMapKeyIterable(this);
35 } 35 }
36 36
37 Iterable<V> get values { 37 Iterable<V> get values {
38 // TODO(floitsch): don't wrap the map twice. 38 // TODO(floitsch): don't wrap the map twice.
floitsch 2013/01/30 14:48:44 Now that map returns an Iterable you can just retu
Lasse Reichstein Nielsen 2013/01/31 11:33:49 Done.
39 return keys.mappedBy((String key) => this[key]); 39 return keys.map((String key) => this[key]);
40 } 40 }
41 41
42 bool get isEmpty => length == 0; 42 bool get isEmpty => length == 0;
43 43
44 String toString() => Maps.mapToString(this); 44 String toString() => Maps.mapToString(this);
45 45
46 _throwUnmodifiable() { 46 _throwUnmodifiable() {
47 throw new UnsupportedError("Cannot modify unmodifiable Map"); 47 throw new UnsupportedError("Cannot modify unmodifiable Map");
48 } 48 }
49 void operator []=(String key, V val) => _throwUnmodifiable(); 49 void operator []=(String key, V val) => _throwUnmodifiable();
(...skipping 17 matching lines...) Expand all
67 return super[key]; 67 return super[key];
68 } 68 }
69 } 69 }
70 70
71 class _ConstantMapKeyIterable extends Iterable<String> { 71 class _ConstantMapKeyIterable extends Iterable<String> {
72 ConstantMap _map; 72 ConstantMap _map;
73 _ConstantMapKeyIterable(this._map); 73 _ConstantMapKeyIterable(this._map);
74 74
75 Iterator<String> get iterator => _map._keys.iterator; 75 Iterator<String> get iterator => _map._keys.iterator;
76 } 76 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698