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

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

Issue 228063002: Construct literal maps using factory constructor. (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
Index: sdk/lib/_internal/lib/collection_patch.dart
diff --git a/sdk/lib/_internal/lib/collection_patch.dart b/sdk/lib/_internal/lib/collection_patch.dart
index 192dfd3e398506236c35b4e50febec5d529b840b..c48aa7be42603502222893e1163bc0abbc1e0532 100644
--- a/sdk/lib/_internal/lib/collection_patch.dart
+++ b/sdk/lib/_internal/lib/collection_patch.dart
@@ -4,6 +4,7 @@
// Patch file for dart:collection classes.
import 'dart:_foreign_helper' show JS;
+import 'dart:_js_helper' show fillLiteralMap, NoInline;
patch class HashMap<K, V> {
patch factory HashMap({ bool equals(K key1, K key2),
@@ -488,6 +489,17 @@ patch class LinkedHashMap<K, V> {
}
patch factory LinkedHashMap.identity() = _LinkedIdentityHashMap<K, V>;
+
+ // Private factory constructors called by generated code for map literals.
+ @NoInline()
+ factory LinkedHashMap._literal(List keyValuePairs) {
+ var map = new _LinkedHashMap<K, V>();
floitsch 2014/04/08 11:53:17 delete line
sra1 2014/04/08 17:55:01 Done.
+ return fillLiteralMap(keyValuePairs, new _LinkedHashMap<K, V>());
+ }
+ @NoInline()
+ factory LinkedHashMap._empty() {
+ return new _LinkedHashMap<K, V>();
+ }
}
class _LinkedHashMap<K, V> implements LinkedHashMap<K, V> {

Powered by Google App Engine
This is Rietveld 408576698