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

Unified Diff: third_party/pkg/angular/lib/change_detection/prototype_map.dart

Issue 176943008: Update the Angular/DI tests to latest from github. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/angular/lib/change_detection/prototype_map.dart
diff --git a/third_party/pkg/angular/lib/change_detection/prototype_map.dart b/third_party/pkg/angular/lib/change_detection/prototype_map.dart
new file mode 100644
index 0000000000000000000000000000000000000000..130444184076b831118d44464deddc8e335bb2fd
--- /dev/null
+++ b/third_party/pkg/angular/lib/change_detection/prototype_map.dart
@@ -0,0 +1,37 @@
+part of angular.watch_group;
+
+class PrototypeMap<K, V> implements Map<K,V> {
+ final Map<K, V> prototype;
+ final Map<K, V> self = new Map();
+
+ PrototypeMap(this.prototype);
+
+ void operator []=(name, value) {
+ self[name] = value;
+ }
+ V operator [](name) => self.containsKey(name) ? self[name] : prototype[name];
+
+ bool get isEmpty => self.isEmpty && prototype.isEmpty;
+ bool get isNotEmpty => self.isNotEmpty || prototype.isNotEmpty;
+ // todo(vbe) include prototype keys ?
+ Iterable<K> get keys => self.keys;
+ // todo(vbe) include prototype values ?
+ Iterable<V> get values => self.values;
+ int get length => self.length;
+
+ void forEach(fn) {
+ // todo(vbe) include prototype ?
+ self.forEach(fn);
+ }
+ V remove(key) => self.remove(key);
+ clear() => self.clear;
+ // todo(vbe) include prototype ?
+ bool containsKey(key) => self.containsKey(key);
+ // todo(vbe) include prototype ?
+ bool containsValue(key) => self.containsValue(key);
+ void addAll(map) {
+ self.addAll(map);
+ }
+ // todo(vbe) include prototype ?
+ V putIfAbsent(key, fn) => self.putIfAbsent(key, fn);
+}

Powered by Google App Engine
This is Rietveld 408576698