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

Unified Diff: sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart

Issue 658103003: Support map and list literals in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
Index: sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart b/sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart
index 850ff3ccfdc70f262d7dddbc88b3efea366644f5..90e40c9fdebac0c6d2b650584461b1501483aec7 100644
--- a/sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart
@@ -370,6 +370,28 @@ class IrBuilder {
state.constantSystem.createString(new ast.DartString.literal(value)));
}
+ /// Creates a non-constant list literal of the provided [type] and with the
+ /// provided [values].
+ ir.Primitive buildListLiteral(InterfaceType type,
+ Iterable<ir.Primitive> values) {
+ assert(isOpen);
+ ir.Primitive result = new ir.LiteralList(type, values);
+ add(new ir.LetPrim(result));
+ return result;
+ }
+
+ /// Creates a non-constant map literal of the provided [type] and with the
+ /// provided [keys] and corresponding [values].
+ ir.Primitive buildMapLiteral(InterfaceType type,
+ Iterable<ir.Primitive> keys,
+ Iterable<ir.Primitive> values) {
+ assert(isOpen);
+ assert(keys.length == values.length);
+ ir.Primitive result = new ir.LiteralMap(type, keys, values);
+ add(new ir.LetPrim(result));
+ return result;
+ }
+
/// Creates a conditional expression with the provided [condition] where the
/// then and else expression are created through the [buildThenExpression] and
/// [buildElseExpression] functions, respectively.

Powered by Google App Engine
This is Rietveld 408576698