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

Unified Diff: lib/compiler/implementation/lib/constant_map.dart

Issue 9873040: Implement constant maps with __proto__ and fix maps with duplicated keys. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/compile_time_constants.dart ('k') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/lib/constant_map.dart
diff --git a/lib/compiler/implementation/lib/constant_map.dart b/lib/compiler/implementation/lib/constant_map.dart
index 0b12f2152c58a29e5ece48809b30dc6dd6d20b2a..14072133fff9975af94eb7e834659ae8682a9d17 100644
--- a/lib/compiler/implementation/lib/constant_map.dart
+++ b/lib/compiler/implementation/lib/constant_map.dart
@@ -48,3 +48,19 @@ class ConstantMap<V> implements Map<String, V> {
V remove(String key) => _throwImmutable();
void clear() => _throwImmutable();
}
+
+// This class has no constructor. This is on purpose since the instantiation
+// is shortcut by the compiler.
+class ConstantProtoMap<V> extends ConstantMap<V> {
+ final V _protoValue;
+
+ bool containsKey(String key) {
+ if (key == '__proto__') return true;
+ return super.containsKey(key);
+ }
+
+ V operator [](String key) {
+ if (key == '__proto__') return _protoValue;
+ return super[key];
+ }
+}
« no previous file with comments | « lib/compiler/implementation/compile_time_constants.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698