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

Unified Diff: pkg/template_binding/test/custom_element_bindings_test.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/yaml/lib/src/yaml_map.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/template_binding/test/custom_element_bindings_test.dart
diff --git a/pkg/template_binding/test/custom_element_bindings_test.dart b/pkg/template_binding/test/custom_element_bindings_test.dart
index 62fb8ee24e12b6a33f514301973d54c73cffb19b..fb2b8ba5b000bbd25b7f7855ffa6b317cf4580a1 100644
--- a/pkg/template_binding/test/custom_element_bindings_test.dart
+++ b/pkg/template_binding/test/custom_element_bindings_test.dart
@@ -6,6 +6,7 @@ library template_binding.test.custom_element_bindings_test;
import 'dart:async';
import 'dart:html';
+import 'dart:collection' show MapView;
import 'package:template_binding/template_binding.dart';
import 'package:observe/observe.dart';
import 'package:unittest/html_config.dart';
@@ -215,34 +216,18 @@ class WithAttrsCustomElement extends HtmlElement {
}
// TODO(jmesserly): would be nice to use mocks when mirrors work on dart2js.
-class AttributeMapWrapper<K, V> implements Map<K, V> {
+class AttributeMapWrapper<K, V> extends MapView<K, V> {
final List log = [];
- Map<K, V> _map;
- AttributeMapWrapper(this._map);
-
- bool containsValue(Object value) => _map.containsValue(value);
- bool containsKey(Object key) => _map.containsKey(key);
- V operator [](Object key) => _map[key];
+ AttributeMapWrapper(Map map) : super(map);
void operator []=(K key, V value) {
log.add(['[]=', key, value]);
- _map[key] = value;
+ super[key] = value;
}
- V putIfAbsent(K key, V ifAbsent()) => _map.putIfAbsent(key, ifAbsent);
-
V remove(Object key) {
log.add(['remove', key]);
- _map.remove(key);
+ super.remove(key);
}
-
- void addAll(Map<K, V> other) => _map.addAll(other);
- void clear() => _map.clear();
- void forEach(void f(K key, V value)) => _map.forEach(f);
- Iterable<K> get keys => _map.keys;
- Iterable<V> get values => _map.values;
- int get length => _map.length;
- bool get isEmpty => _map.isEmpty;
- bool get isNotEmpty => _map.isNotEmpty;
}
« no previous file with comments | « no previous file | pkg/yaml/lib/src/yaml_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698