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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dart_backend/tree_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: Use LiteralMapEntry to ensure build order Created 6 years, 1 month 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 tree_ir_builder; 5 library tree_ir_builder;
6 6
7 import '../dart2jslib.dart' as dart2js; 7 import '../dart2jslib.dart' as dart2js;
8 import '../dart_types.dart'; 8 import '../dart_types.dart';
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../cps_ir/cps_ir_nodes.dart' as cps_ir; 10 import '../cps_ir/cps_ir_nodes.dart' as cps_ir;
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 423
424 Expression visitLiteralList(cps_ir.LiteralList node) { 424 Expression visitLiteralList(cps_ir.LiteralList node) {
425 return new LiteralList( 425 return new LiteralList(
426 node.type, 426 node.type,
427 translateArguments(node.values)); 427 translateArguments(node.values));
428 } 428 }
429 429
430 Expression visitLiteralMap(cps_ir.LiteralMap node) { 430 Expression visitLiteralMap(cps_ir.LiteralMap node) {
431 return new LiteralMap( 431 return new LiteralMap(
432 node.type, 432 node.type,
433 translateArguments(node.keys), 433 new List<LiteralMapEntry>.generate(node.entries.length, (int index) {
434 translateArguments(node.values)); 434 return new LiteralMapEntry(
435 getVariableReference(node.entries[index].key),
436 getVariableReference(node.entries[index].value));
437 })
438 );
435 } 439 }
436 440
437 FunctionDefinition makeSubFunction(cps_ir.FunctionDefinition function) { 441 FunctionDefinition makeSubFunction(cps_ir.FunctionDefinition function) {
438 return new Builder.inner(this).build(function); 442 return new Builder.inner(this).build(function);
439 } 443 }
440 444
441 Node visitCreateFunction(cps_ir.CreateFunction node) { 445 Node visitCreateFunction(cps_ir.CreateFunction node) {
442 FunctionDefinition def = makeSubFunction(node.definition); 446 FunctionDefinition def = makeSubFunction(node.definition);
443 FunctionType type = node.definition.element.type; 447 FunctionType type = node.definition.element.type;
444 bool hasReturnType = !type.returnType.treatAsDynamic; 448 bool hasReturnType = !type.returnType.treatAsDynamic;
(...skipping 18 matching lines...) Expand all
463 // visited. 467 // visited.
464 compiler.internalError(compiler.currentElement, 'Unexpected IR node.'); 468 compiler.internalError(compiler.currentElement, 'Unexpected IR node.');
465 return null; 469 return null;
466 } 470 }
467 471
468 Expression visitIsTrue(cps_ir.IsTrue node) { 472 Expression visitIsTrue(cps_ir.IsTrue node) {
469 return getVariableReference(node.value); 473 return getVariableReference(node.value);
470 } 474 }
471 } 475 }
472 476
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698