Index: lib/src/codegen/js_codegen.dart |
diff --git a/lib/src/codegen/js_codegen.dart b/lib/src/codegen/js_codegen.dart |
index 6c98ba55310c4645181dd7d89c8abab27d0b2631..5d17009dd656209af7ea01da6b586751cbc77890 100644 |
--- a/lib/src/codegen/js_codegen.dart |
+++ b/lib/src/codegen/js_codegen.dart |
@@ -3251,7 +3251,8 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ClosureAnnotator { |
JS.Expression emitMap() { |
var entries = node.entries; |
var mapArguments = null; |
- if (entries.isEmpty) { |
+ var typeArgs = node.typeArguments; |
+ if (entries.isEmpty && typeArgs == null) { |
mapArguments = []; |
} else if (entries.every((e) => e.key is StringLiteral)) { |
// Use JS object literal notation if possible, otherwise use an array. |
@@ -3270,8 +3271,11 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ClosureAnnotator { |
} |
mapArguments = new JS.ArrayInitializer(values); |
} |
- // TODO(jmesserly): add generic types args. |
- return js.call('dart.map(#)', [mapArguments]); |
+ var types = <JS.Expression>[]; |
+ if (typeArgs != null) { |
+ types.addAll(typeArgs.arguments.map((e) => _emitTypeName(e.type))); |
+ } |
+ return js.call('dart.map(#, #)', [mapArguments, types]); |
} |
if (node.constKeyword != null) return _emitConst(emitMap); |
return emitMap(); |