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 |
367 Statement visitThrow(cps_ir.Throw node) { | 373 Statement visitThrow(cps_ir.Throw node) { |
368 Expression value = getVariableUse(node.value); | 374 Expression value = getVariableUse(node.value); |
369 return new Throw(value); | 375 return new Throw(value); |
370 } | 376 } |
371 | 377 |
372 Statement visitRethrow(cps_ir.Rethrow node) { | 378 Statement visitRethrow(cps_ir.Rethrow node) { |
373 return new Rethrow(); | 379 return new Rethrow(); |
374 } | 380 } |
375 | 381 |
376 Statement visitUnreachable(cps_ir.Unreachable node) { | 382 Statement visitUnreachable(cps_ir.Unreachable node) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 thenStatement = | 492 thenStatement = |
487 cont.hasExactlyOneUse ? visit(cont.body) : new Break(labels[cont]); | 493 cont.hasExactlyOneUse ? visit(cont.body) : new Break(labels[cont]); |
488 cont = node.falseContinuation.definition; | 494 cont = node.falseContinuation.definition; |
489 assert(cont.parameters.isEmpty); | 495 assert(cont.parameters.isEmpty); |
490 elseStatement = | 496 elseStatement = |
491 cont.hasExactlyOneUse ? visit(cont.body) : new Break(labels[cont]); | 497 cont.hasExactlyOneUse ? visit(cont.body) : new Break(labels[cont]); |
492 return new If(condition, thenStatement, elseStatement); | 498 return new If(condition, thenStatement, elseStatement); |
493 } | 499 } |
494 | 500 |
495 Expression visitConstant(cps_ir.Constant node) { | 501 Expression visitConstant(cps_ir.Constant node) { |
496 return new Constant(node.value); | 502 return new Constant(node.expression, node.value); |
497 } | 503 } |
498 | 504 |
499 Expression visitLiteralList(cps_ir.LiteralList node) { | 505 Expression visitLiteralList(cps_ir.LiteralList node) { |
500 return new LiteralList( | 506 return new LiteralList( |
501 node.type, | 507 node.type, |
502 translateArguments(node.values)); | 508 translateArguments(node.values)); |
503 } | 509 } |
504 | 510 |
505 Expression visitLiteralMap(cps_ir.LiteralMap node) { | 511 Expression visitLiteralMap(cps_ir.LiteralMap node) { |
506 return new LiteralMap( | 512 return new LiteralMap( |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 return new ApplyBuiltinOperator(node.operator, | 591 return new ApplyBuiltinOperator(node.operator, |
586 translateArguments(node.arguments)); | 592 translateArguments(node.arguments)); |
587 } | 593 } |
588 | 594 |
589 @override | 595 @override |
590 visitForeignCode(cps_ir.ForeignCode node) { | 596 visitForeignCode(cps_ir.ForeignCode node) { |
591 unexpectedNode(node); | 597 unexpectedNode(node); |
592 } | 598 } |
593 } | 599 } |
594 | 600 |
OLD | NEW |