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

Unified Diff: sdk/lib/io/platform_impl.dart

Issue 325533002: Fixed toString of Platform.environment on Windows (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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/io/io.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/platform_impl.dart
diff --git a/sdk/lib/io/platform_impl.dart b/sdk/lib/io/platform_impl.dart
index c6063a8c21265283f710ee427b0d959041586bc7..a7631275628111a73343badb51eaee4039a35317 100644
--- a/sdk/lib/io/platform_impl.dart
+++ b/sdk/lib/io/platform_impl.dart
@@ -71,7 +71,7 @@ class _Platform {
result[str.substring(0, equalsIndex)] =
str.substring(equalsIndex + 1);
}
- _environmentCache = new UnmodifiableMapView(result);
+ _environmentCache = new UnmodifiableMapView<String, String>(result);
} else {
_environmentCache = env;
}
@@ -89,36 +89,20 @@ class _Platform {
// Environment variables are case-insensitive on Windows. In order
// to reflect that we use a case-insensitive string map on Windows.
-class _CaseInsensitiveStringMap<V> implements Map<String, V> {
- Map<String, V> _map;
+class _CaseInsensitiveStringMap<V> extends MapMixin<String, V> {
Lasse Reichstein Nielsen 2014/06/07 12:49:40 Extend MapBase instead of MapMixin. It's silly to
+ final Map<String, V> _map = new Map<String, V>();
- _CaseInsensitiveStringMap() : _map = new Map<String, V>();
-
- _CaseInsensitiveStringMap.from(Map<String, V> other)
- : _map = new Map<String, V>() {
- other.forEach((String key, V value) {
- _map[key.toUpperCase()] = value;
- });
- }
-
- bool containsKey(String key) => _map.containsKey(key.toUpperCase());
- bool containsValue(Object value) => _map.containsValue(value);
V operator [](String key) => _map[key.toUpperCase()];
+
void operator []=(String key, V value) {
_map[key.toUpperCase()] = value;
}
- V putIfAbsent(String key, V ifAbsent()) {
- _map.putIfAbsent(key.toUpperCase(), ifAbsent);
- }
- addAll(Map other) {
- other.forEach((key, value) => this[key.toUpperCase()] = value);
- }
+
V remove(String key) => _map.remove(key.toUpperCase());
Lasse Reichstein Nielsen 2014/06/07 12:49:41 Remove should take an Object as argument, and just
+
void clear() => _map.clear();
- void forEach(void f(String key, V value)) => _map.forEach(f);
+
Iterable<String> 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;
+
+ String toString() => _map.toString();
}
Lasse Reichstein Nielsen 2014/06/09 09:55:20 If all of this is to just have a better toString,
« no previous file with comments | « sdk/lib/io/io.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698