| 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 '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
| 9 import '../cps_ir/cps_ir_nodes.dart' as cps_ir; | 9 import '../cps_ir/cps_ir_nodes.dart' as cps_ir; |
| 10 import '../util/util.dart' show CURRENT_ELEMENT_SPANNABLE; | 10 import '../util/util.dart' show CURRENT_ELEMENT_SPANNABLE; |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 357 } |
| 358 | 358 |
| 359 Statement visitInvokeMethodDirectly(cps_ir.InvokeMethodDirectly node) { | 359 Statement visitInvokeMethodDirectly(cps_ir.InvokeMethodDirectly node) { |
| 360 Expression receiver = getVariableUse(node.receiver); | 360 Expression receiver = getVariableUse(node.receiver); |
| 361 List<Expression> arguments = translateArguments(node.arguments); | 361 List<Expression> arguments = translateArguments(node.arguments); |
| 362 Expression invoke = new InvokeMethodDirectly(receiver, node.target, | 362 Expression invoke = new InvokeMethodDirectly(receiver, node.target, |
| 363 node.selector, arguments); | 363 node.selector, arguments); |
| 364 return continueWithExpression(node.continuation, invoke); | 364 return continueWithExpression(node.continuation, invoke); |
| 365 } | 365 } |
| 366 | 366 |
| 367 Statement visitConcatenateStrings(cps_ir.ConcatenateStrings node) { | |
| 368 List<Expression> arguments = translateArguments(node.arguments); | |
| 369 Expression concat = new ConcatenateStrings(arguments); | |
| 370 return continueWithExpression(node.continuation, concat); | |
| 371 } | |
| 372 | |
| 373 Statement visitThrow(cps_ir.Throw node) { | 367 Statement visitThrow(cps_ir.Throw node) { |
| 374 Expression value = getVariableUse(node.value); | 368 Expression value = getVariableUse(node.value); |
| 375 return new Throw(value); | 369 return new Throw(value); |
| 376 } | 370 } |
| 377 | 371 |
| 378 Statement visitRethrow(cps_ir.Rethrow node) { | 372 Statement visitRethrow(cps_ir.Rethrow node) { |
| 379 return new Rethrow(); | 373 return new Rethrow(); |
| 380 } | 374 } |
| 381 | 375 |
| 382 Statement visitUnreachable(cps_ir.Unreachable node) { | 376 Statement visitUnreachable(cps_ir.Unreachable node) { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 thenStatement = | 486 thenStatement = |
| 493 cont.hasExactlyOneUse ? visit(cont.body) : new Break(labels[cont]); | 487 cont.hasExactlyOneUse ? visit(cont.body) : new Break(labels[cont]); |
| 494 cont = node.falseContinuation.definition; | 488 cont = node.falseContinuation.definition; |
| 495 assert(cont.parameters.isEmpty); | 489 assert(cont.parameters.isEmpty); |
| 496 elseStatement = | 490 elseStatement = |
| 497 cont.hasExactlyOneUse ? visit(cont.body) : new Break(labels[cont]); | 491 cont.hasExactlyOneUse ? visit(cont.body) : new Break(labels[cont]); |
| 498 return new If(condition, thenStatement, elseStatement); | 492 return new If(condition, thenStatement, elseStatement); |
| 499 } | 493 } |
| 500 | 494 |
| 501 Expression visitConstant(cps_ir.Constant node) { | 495 Expression visitConstant(cps_ir.Constant node) { |
| 502 return new Constant(node.expression, node.value); | 496 return new Constant(node.value); |
| 503 } | 497 } |
| 504 | 498 |
| 505 Expression visitLiteralList(cps_ir.LiteralList node) { | 499 Expression visitLiteralList(cps_ir.LiteralList node) { |
| 506 return new LiteralList( | 500 return new LiteralList( |
| 507 node.type, | 501 node.type, |
| 508 translateArguments(node.values)); | 502 translateArguments(node.values)); |
| 509 } | 503 } |
| 510 | 504 |
| 511 Expression visitLiteralMap(cps_ir.LiteralMap node) { | 505 Expression visitLiteralMap(cps_ir.LiteralMap node) { |
| 512 return new LiteralMap( | 506 return new LiteralMap( |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 return new ApplyBuiltinOperator(node.operator, | 585 return new ApplyBuiltinOperator(node.operator, |
| 592 translateArguments(node.arguments)); | 586 translateArguments(node.arguments)); |
| 593 } | 587 } |
| 594 | 588 |
| 595 @override | 589 @override |
| 596 visitForeignCode(cps_ir.ForeignCode node) { | 590 visitForeignCode(cps_ir.ForeignCode node) { |
| 597 unexpectedNode(node); | 591 unexpectedNode(node); |
| 598 } | 592 } |
| 599 } | 593 } |
| 600 | 594 |
| OLD | NEW |