Index: sdk/lib/_internal/compiler/js_lib/collection_patch.dart |
diff --git a/sdk/lib/_internal/compiler/js_lib/collection_patch.dart b/sdk/lib/_internal/compiler/js_lib/collection_patch.dart |
index 9242d392644fff7ec59795c0debf71fa905b9f4b..8fc49b210ef35ef8be7e8af4a573146f0e452187 100644 |
--- a/sdk/lib/_internal/compiler/js_lib/collection_patch.dart |
+++ b/sdk/lib/_internal/compiler/js_lib/collection_patch.dart |
@@ -5,8 +5,9 @@ |
// Patch file for dart:collection classes. |
import 'dart:_foreign_helper' show JS; |
import 'dart:_js_helper' show |
- fillLiteralMap, InternalMap, NoInline, NoThrows, patch, JsLinkedHashMap, |
- LinkedHashMapCell, LinkedHashMapKeyIterable, LinkedHashMapKeyIterator; |
+ fillLiteralMap, InternalMap, NoInline, NoSideEffects, NoThrows, patch, |
+ JsLinkedHashMap, LinkedHashMapCell, LinkedHashMapKeyIterable, |
+ LinkedHashMapKeyIterator; |
@patch |
class HashMap<K, V> { |
@@ -386,6 +387,7 @@ class _CustomHashMap<K, V> extends _HashMap<K, V> { |
final _Equality<K> _equals; |
final _Hasher<K> _hashCode; |
final _Predicate _validKey; |
+ |
_CustomHashMap(this._equals, this._hashCode, bool validKey(potentialKey)) |
: _validKey = (validKey != null) ? validKey : ((v) => v is K); |
@@ -492,7 +494,7 @@ class LinkedHashMap<K, V> { |
if (isValidKey == null) { |
if (hashCode == null) { |
if (equals == null) { |
- return new JsLinkedHashMap<K, V>(); |
+ return new JsLinkedHashMap<K, V>.es6(); |
} |
hashCode = _defaultHashCode; |
} else { |
@@ -521,16 +523,17 @@ class LinkedHashMap<K, V> { |
// Private factory constructor called by generated code for map literals. |
@NoInline() |
factory LinkedHashMap._literal(List keyValuePairs) { |
- return fillLiteralMap(keyValuePairs, new JsLinkedHashMap<K, V>()); |
+ return fillLiteralMap(keyValuePairs, new JsLinkedHashMap<K, V>.es6()); |
} |
// Private factory constructor called by generated code for map literals. |
- @NoThrows() @NoInline() |
+ @NoThrows() @NoInline() @NoSideEffects() |
factory LinkedHashMap._empty() { |
- return new JsLinkedHashMap<K, V>(); |
+ return new JsLinkedHashMap<K, V>.es6(); |
} |
} |
+// TODO(floitsch): use ES6 Maps when available. |
class _LinkedIdentityHashMap<K, V> extends JsLinkedHashMap<K, V> { |
int internalComputeHashCode(var key) { |
// We force the hash codes to be unsigned 30-bit integers to avoid |
@@ -550,10 +553,12 @@ class _LinkedIdentityHashMap<K, V> extends JsLinkedHashMap<K, V> { |
} |
} |
+// TODO(floitsch): use ES6 maps when available. |
class _LinkedCustomHashMap<K, V> extends JsLinkedHashMap<K, V> { |
final _Equality<K> _equals; |
final _Hasher<K> _hashCode; |
final _Predicate _validKey; |
+ |
_LinkedCustomHashMap(this._equals, this._hashCode, |
bool validKey(potentialKey)) |
: _validKey = (validKey != null) ? validKey : ((v) => v is K); |