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

Unified Diff: lib/runtime/dart/_runtime.js

Issue 1611753002: fixes #415, correct type for map literals (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: add TODO Created 4 years, 11 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 | « no previous file | lib/runtime/dart/convert.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/runtime/dart/_runtime.js
diff --git a/lib/runtime/dart/_runtime.js b/lib/runtime/dart/_runtime.js
index 777582d1ba760dda17a1b099c4f96fef9a7e9c13..47ef79427ce9949670b666f8ff9e6b7ce6307c95 100644
--- a/lib/runtime/dart/_runtime.js
+++ b/lib/runtime/dart/_runtime.js
@@ -520,20 +520,26 @@ dart_library.library('dart/_runtime', null, /* Imports */[
if (x == null) throwNullValueError();
return x;
}
- function map(values) {
- let map = collection.LinkedHashMap.new();
- if (Array.isArray(values)) {
- for (let i = 0, end = values.length - 1; i < end; i += 2) {
- let key = values[i];
- let value = values[i + 1];
- map.set(key, value);
- }
- } else if (typeof values === 'object') {
- for (let key of getOwnPropertyNames(values)) {
- map.set(key, values[key]);
+ function map(values, K, V) {
+ if (K === void 0) K = null;
+ if (V === void 0) V = null;
+ return (() => {
+ if (K == null) K = dynamicR;
+ if (V == null) V = dynamicR;
+ let map = getGenericClass(collection.LinkedHashMap)(K, V).new();
+ if (Array.isArray(values)) {
+ for (let i = 0, end = values.length - 1; i < end; i += 2) {
+ let key = values[i];
+ let value = values[i + 1];
+ map.set(key, value);
+ }
+ } else if (typeof values === 'object') {
+ for (let key of getOwnPropertyNames(values)) {
+ map.set(key, values[key]);
+ }
}
- }
- return map;
+ return map;
+ })();
}
function assert_(condition) {
if (!condition) throwAssertionError();
« no previous file with comments | « no previous file | lib/runtime/dart/convert.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698