| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |