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

Unified Diff: tool/input_sdk/private/operations.dart

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 | « test/codegen/expect/language-all.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tool/input_sdk/private/operations.dart
diff --git a/tool/input_sdk/private/operations.dart b/tool/input_sdk/private/operations.dart
index 79fbd7b9c87ee976e873ac5d7405f15497f1524c..842ad6e5a6af470459523f7be1ad4486b5d15189 100644
--- a/tool/input_sdk/private/operations.dart
+++ b/tool/input_sdk/private/operations.dart
@@ -246,8 +246,12 @@ notNull(x) => JS('', '''(() => {
/// example `map()`.
///
// TODO(jmesserly): this could be faster
-map(values) => JS('', '''(() => {
- let map = $LinkedHashMap.new();
+// TODO(jmesserly): we can use default values `= dynamic` once #417 is fixed.
+// TODO(jmesserly): move this to classes for consistentcy with list literals?
+map(values, [K, V]) => JS('', '''(() => {
+ if ($K == null) $K = $dynamicR;
+ if ($V == null) $V = $dynamicR;
+ let map = ${getGenericClass(LinkedHashMap)}($K, $V).new();
if (Array.isArray($values)) {
for (let i = 0, end = $values.length - 1; i < end; i += 2) {
let key = $values[i];
« no previous file with comments | « test/codegen/expect/language-all.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698