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]; |