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

Unified Diff: sdk/lib/_internal/lib/js_mirrors.dart

Issue 246833003: Revert "Remove unmodifiable map wrappers that could instead use UnmodifiableMapView." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « sdk/lib/_internal/compiler/implementation/mirrors/util.dart ('k') | sdk/lib/core/uri.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/lib/js_mirrors.dart
diff --git a/sdk/lib/_internal/lib/js_mirrors.dart b/sdk/lib/_internal/lib/js_mirrors.dart
index b67e6b43f3e8be0fcb93a8e7a3512e99bb44bc17..1036bfdb25540a67d5e265feb3ca4b8c3aefdfed 100644
--- a/sdk/lib/_internal/lib/js_mirrors.dart
+++ b/sdk/lib/_internal/lib/js_mirrors.dart
@@ -7,8 +7,7 @@ library dart._js_mirrors;
import 'dart:async';
import 'dart:collection' show
- UnmodifiableListView,
- UnmodifiableMapView;
+ UnmodifiableListView;
import 'dart:mirrors';
@@ -2836,6 +2835,45 @@ class NoSuchStaticMethodError extends Error implements NoSuchMethodError {
}
}
+// Copied from package "unmodifiable_collection".
+// TODO(14314): Move to dart:collection.
+class UnmodifiableMapView<K, V> implements Map<K, V> {
+ Map<K, V> _source;
+ UnmodifiableMapView(Map<K, V> source) : _source = source;
+
+ static void _throw() {
+ throw new UnsupportedError("Cannot modify an unmodifiable Map");
+ }
+
+ int get length => _source.length;
+
+ bool get isEmpty => _source.isEmpty;
+
+ bool get isNotEmpty => _source.isNotEmpty;
+
+ V operator [](K key) => _source[key];
+
+ bool containsKey(K key) => _source.containsKey(key);
+
+ bool containsValue(V value) => _source.containsValue(value);
+
+ void forEach(void f(K key, V value)) => _source.forEach(f);
+
+ Iterable<K> get keys => _source.keys;
+
+ Iterable<V> get values => _source.values;
+
+ void operator []=(K key, V value) => _throw();
+
+ V putIfAbsent(K key, V ifAbsent()) { _throw(); }
+
+ void addAll(Map<K, V> other) => _throw();
+
+ V remove(K key) { _throw(); }
+
+ void clear() => _throw();
+}
+
Symbol getSymbol(String name, LibraryMirror library) {
if (_isPublicSymbol(name)) {
return new _symbol_dev.Symbol.validated(name);
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/mirrors/util.dart ('k') | sdk/lib/core/uri.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698