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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.ir_builder; 5 library dart2js.ir_builder;
6 6
7 import '../constants/expressions.dart'; 7 import '../constants/expressions.dart';
8 import '../constants/values.dart' show PrimitiveConstantValue; 8 import '../constants/values.dart' show PrimitiveConstantValue;
9 import '../dart_backend/dart_backend.dart' show DartBackend; 9 import '../dart_backend/dart_backend.dart' show DartBackend;
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 ir.Constant buildNullLiteral() { 363 ir.Constant buildNullLiteral() {
364 return _buildPrimitiveConstant(state.constantSystem.createNull()); 364 return _buildPrimitiveConstant(state.constantSystem.createNull());
365 } 365 }
366 366
367 /// Create a string literal. 367 /// Create a string literal.
368 ir.Constant buildStringLiteral(String value) { 368 ir.Constant buildStringLiteral(String value) {
369 return _buildPrimitiveConstant( 369 return _buildPrimitiveConstant(
370 state.constantSystem.createString(new ast.DartString.literal(value))); 370 state.constantSystem.createString(new ast.DartString.literal(value)));
371 } 371 }
372 372
373 /// Creates a non-constant list literal of the provided [type] and with the
374 /// provided [values].
375 ir.Primitive buildListLiteral(InterfaceType type,
376 Iterable<ir.Primitive> values) {
377 assert(isOpen);
378 ir.Primitive result = new ir.LiteralList(type, values);
379 add(new ir.LetPrim(result));
380 return result;
381 }
382
383 /// Creates a non-constant map literal of the provided [type] and with the
384 /// provided [keys] and corresponding [values].
385 ir.Primitive buildMapLiteral(InterfaceType type,
386 Iterable<ir.Primitive> keys,
387 Iterable<ir.Primitive> values) {
388 assert(isOpen);
389 assert(keys.length == values.length);
390 ir.Primitive result = new ir.LiteralMap(type, keys, values);
391 add(new ir.LetPrim(result));
392 return result;
393 }
394
373 /// Creates a conditional expression with the provided [condition] where the 395 /// Creates a conditional expression with the provided [condition] where the
374 /// then and else expression are created through the [buildThenExpression] and 396 /// then and else expression are created through the [buildThenExpression] and
375 /// [buildElseExpression] functions, respectively. 397 /// [buildElseExpression] functions, respectively.
376 ir.Primitive buildConditional( 398 ir.Primitive buildConditional(
377 ir.Primitive condition, 399 ir.Primitive condition,
378 ir.Primitive buildThenExpression(IrBuilder builder), 400 ir.Primitive buildThenExpression(IrBuilder builder),
379 ir.Primitive buildElseExpression(IrBuilder builder)) { 401 ir.Primitive buildElseExpression(IrBuilder builder)) {
380 402
381 assert(isOpen); 403 assert(isOpen);
382 404
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 index = 0; 863 index = 0;
842 for (int i = 0; i < environment.length; ++i) { 864 for (int i = 0; i < environment.length; ++i) {
843 if (common[i] == null) { 865 if (common[i] == null) {
844 environment.index2value[i] = parameters[index++]; 866 environment.index2value[i] = parameters[index++];
845 } 867 }
846 } 868 }
847 869
848 return join; 870 return join;
849 } 871 }
850 } 872 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698