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

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

Issue 228293008: Redo "Construct literal maps using factory constructor." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add constructors to mock libraries for dart2js tests 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/compiler/implementation/ssa/builder.dart ('k') | sdk/lib/_internal/lib/js_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a7e7ee25f3029aa7ece7e59f3827117d9b2c11c8 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,18 @@ patch class LinkedHashMap<K, V> {
}
patch factory LinkedHashMap.identity() = _LinkedIdentityHashMap<K, V>;
+
+ // Private factory constructor called by generated code for map literals.
+ @NoInline()
+ factory LinkedHashMap._literal(List keyValuePairs) {
+ return fillLiteralMap(keyValuePairs, new _LinkedHashMap<K, V>());
+ }
+
+ // Private factory constructor called by generated code for map literals.
+ @NoInline()
+ factory LinkedHashMap._empty() {
+ return new _LinkedHashMap<K, V>();
+ }
}
class _LinkedHashMap<K, V> implements LinkedHashMap<K, V> {
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | sdk/lib/_internal/lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698