| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 class _Platform { | 7 class _Platform { |
| 8 external static int _numberOfProcessors(); | 8 external static int _numberOfProcessors(); |
| 9 external static String _pathSeparator(); | 9 external static String _pathSeparator(); |
| 10 external static String _operatingSystem(); | 10 external static String _operatingSystem(); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 static String get version => _version(); | 91 static String get version => _version(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 // Environment variables are case-insensitive on Windows. In order | 94 // Environment variables are case-insensitive on Windows. In order |
| 95 // to reflect that we use a case-insensitive string map on Windows. | 95 // to reflect that we use a case-insensitive string map on Windows. |
| 96 class _CaseInsensitiveStringMap<V> implements Map<String, V> { | 96 class _CaseInsensitiveStringMap<V> implements Map<String, V> { |
| 97 final Map<String, V> _map = new Map<String, V>(); | 97 final Map<String, V> _map = new Map<String, V>(); |
| 98 | 98 |
| 99 bool containsKey(String key) => _map.containsKey(key.toUpperCase()); | 99 bool containsKey(Object key) => |
| 100 key is String && _map.containsKey(key.toUpperCase()); |
| 100 bool containsValue(Object value) => _map.containsValue(value); | 101 bool containsValue(Object value) => _map.containsValue(value); |
| 101 V operator [](String key) => _map[key.toUpperCase()]; | 102 V operator [](Object key) => key is String ? _map[key.toUpperCase()] : null; |
| 102 void operator []=(String key, V value) { | 103 void operator []=(String key, V value) { |
| 103 _map[key.toUpperCase()] = value; | 104 _map[key.toUpperCase()] = value; |
| 104 } | 105 } |
| 105 V putIfAbsent(String key, V ifAbsent()) { | 106 V putIfAbsent(String key, V ifAbsent()) { |
| 106 _map.putIfAbsent(key.toUpperCase(), ifAbsent); | 107 return _map.putIfAbsent(key.toUpperCase(), ifAbsent); |
| 107 } | 108 } |
| 108 addAll(Map other) { | 109 void addAll(Map other) { |
| 109 other.forEach((key, value) => this[key.toUpperCase()] = value); | 110 other.forEach((key, value) => this[key.toUpperCase()] = value); |
| 110 } | 111 } |
| 111 V remove(String key) => _map.remove(key.toUpperCase()); | 112 V remove(Object key) => key is String ? _map.remove(key.toUpperCase()) : null; |
| 112 void clear() { _map.clear(); } | 113 void clear() { _map.clear(); } |
| 113 void forEach(void f(String key, V value)) { _map.forEach(f); } | 114 void forEach(void f(String key, V value)) { _map.forEach(f); } |
| 114 Iterable<String> get keys => _map.keys; | 115 Iterable<String> get keys => _map.keys; |
| 115 Iterable<V> get values => _map.values; | 116 Iterable<V> get values => _map.values; |
| 116 int get length => _map.length; | 117 int get length => _map.length; |
| 117 bool get isEmpty => _map.isEmpty; | 118 bool get isEmpty => _map.isEmpty; |
| 118 bool get isNotEmpty => _map.isNotEmpty; | 119 bool get isNotEmpty => _map.isNotEmpty; |
| 119 String toString() => _map.toString(); | 120 String toString() => _map.toString(); |
| 120 } | 121 } |
| OLD | NEW |