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

Unified Diff: sdk/lib/core/uri.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/lib/js_mirrors.dart ('k') | sdk/lib/io/http_headers.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/uri.dart
diff --git a/sdk/lib/core/uri.dart b/sdk/lib/core/uri.dart
index 091e1fece45903402fde1890ed9698afe85b10e8..7787a1f8e499cf9bc771676f99872a444c1a9c5c 100644
--- a/sdk/lib/core/uri.dart
+++ b/sdk/lib/core/uri.dart
@@ -726,7 +726,7 @@ class Uri {
*/
Map<String, String> get queryParameters {
if (_queryParameters == null) {
- _queryParameters = new UnmodifiableMapView(splitQueryString(query));
+ _queryParameters = new _UnmodifiableMap(splitQueryString(query));
}
return _queryParameters;
}
@@ -1849,3 +1849,33 @@ class Uri {
// pqrstuvwxyz ~
0x47ff]; // 0x70 - 0x7f 1111111111100010
}
+
+class _UnmodifiableMap<K, V> implements Map<K, V> {
+ final Map _map;
+ const _UnmodifiableMap(this._map);
+
+ bool containsValue(Object value) => _map.containsValue(value);
+ bool containsKey(Object key) => _map.containsKey(key);
+ V operator [](Object key) => _map[key];
+ void operator []=(K key, V value) {
+ throw new UnsupportedError("Cannot modify an unmodifiable map");
+ }
+ V putIfAbsent(K key, V ifAbsent()) {
+ throw new UnsupportedError("Cannot modify an unmodifiable map");
+ }
+ addAll(Map other) {
+ throw new UnsupportedError("Cannot modify an unmodifiable map");
+ }
+ V remove(Object key) {
+ throw new UnsupportedError("Cannot modify an unmodifiable map");
+ }
+ void clear() {
+ throw new UnsupportedError("Cannot modify an unmodifiable map");
+ }
+ 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 | « sdk/lib/_internal/lib/js_mirrors.dart ('k') | sdk/lib/io/http_headers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698