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

Unified Diff: pkg/analyzer2dart/lib/src/cps_generator.dart

Issue 658103003: Support map and list literals in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use LiteralMapEntry to ensure build order Created 6 years, 2 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 | pkg/analyzer2dart/test/end2end_data.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer2dart/lib/src/cps_generator.dart
diff --git a/pkg/analyzer2dart/lib/src/cps_generator.dart b/pkg/analyzer2dart/lib/src/cps_generator.dart
index a8c7698a88efa3462f72e5910877e925e2173a0b..ec3209215c9646f1e4bae3687a6594f2e32c0c79 100644
--- a/pkg/analyzer2dart/lib/src/cps_generator.dart
+++ b/pkg/analyzer2dart/lib/src/cps_generator.dart
@@ -304,6 +304,25 @@ class CpsGeneratingVisitor extends SemanticVisitor<ir.Node>
}
@override
+ ir.Node visitListLiteral(ListLiteral node) {
+ dart2js.InterfaceType type = converter.convertType(node.staticType);
+ // TODO(johnniwinther): Use `build` instead of `(e) => build(e)` when issue
+ // 18630 has been resolved.
+ Iterable<ir.Primitive> values = node.elements.map((e) => build(e));
+ return irBuilder.buildListLiteral(type, values);
+ }
+
+ @override
+ ir.Node visitMapLiteral(MapLiteral node) {
+ dart2js.InterfaceType type = converter.convertType(node.staticType);
+ return irBuilder.buildMapLiteral(
+ type,
+ node.entries.map((e) => e.key),
+ node.entries.map((e) => e.value),
+ build);
+ }
+
+ @override
visitForStatement(ForStatement node) {
// TODO(johnniwinther): Support `for` as a jump target.
SubbuildFunction buildInitializer;
« no previous file with comments | « no previous file | pkg/analyzer2dart/test/end2end_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698