| 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 '../diagnostics/invariant.dart' show | 7 import '../diagnostics/invariant.dart' show |
| 8 InternalErrorFunction; | 8 InternalErrorFunction; |
| 9 import '../diagnostics/spannable.dart' show | 9 import '../diagnostics/spannable.dart' show |
| 10 CURRENT_ELEMENT_SPANNABLE; | 10 CURRENT_ELEMENT_SPANNABLE; |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 node.dartType, | 634 node.dartType, |
| 635 node.arguments.map(getVariableUse).toList()); | 635 node.arguments.map(getVariableUse).toList()); |
| 636 } | 636 } |
| 637 | 637 |
| 638 Expression visitTypeTest(cps_ir.TypeTest node) { | 638 Expression visitTypeTest(cps_ir.TypeTest node) { |
| 639 Expression value = getVariableUse(node.value); | 639 Expression value = getVariableUse(node.value); |
| 640 List<Expression> typeArgs = translateArguments(node.typeArguments); | 640 List<Expression> typeArgs = translateArguments(node.typeArguments); |
| 641 return new TypeOperator(value, node.dartType, typeArgs, isTypeTest: true); | 641 return new TypeOperator(value, node.dartType, typeArgs, isTypeTest: true); |
| 642 } | 642 } |
| 643 | 643 |
| 644 Expression visitTypeTestRaw(cps_ir.TypeTestRaw node) { |
| 645 if (node.usePropertyTest) { |
| 646 Expression value = getVariableUse(node.value); |
| 647 // TODO(sra): Move !! to cps_ir level. |
| 648 return new Not(new Not(new GetTypeTestProperty(value, node.dartType))); |
| 649 } |
| 650 Expression value = getVariableUse(node.value); |
| 651 List<Expression> typeArgs = <Expression>[]; |
| 652 return new TypeOperator(value, node.dartType, typeArgs, isTypeTest: true); |
| 653 } |
| 654 |
| 644 Expression visitGetStatic(cps_ir.GetStatic node) { | 655 Expression visitGetStatic(cps_ir.GetStatic node) { |
| 645 return new GetStatic(node.element, node.sourceInformation); | 656 return new GetStatic(node.element, node.sourceInformation); |
| 646 } | 657 } |
| 647 | 658 |
| 648 Expression visitSetStatic(cps_ir.SetStatic node) { | 659 Expression visitSetStatic(cps_ir.SetStatic node) { |
| 649 return new SetStatic( | 660 return new SetStatic( |
| 650 node.element, | 661 node.element, |
| 651 getVariableUse(node.value), | 662 getVariableUse(node.value), |
| 652 node.sourceInformation); | 663 node.sourceInformation); |
| 653 } | 664 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 internalError(CURRENT_ELEMENT_SPANNABLE, 'Unexpected IR node: $node'); | 704 internalError(CURRENT_ELEMENT_SPANNABLE, 'Unexpected IR node: $node'); |
| 694 } | 705 } |
| 695 | 706 |
| 696 visitFunctionDefinition(cps_ir.FunctionDefinition node) { | 707 visitFunctionDefinition(cps_ir.FunctionDefinition node) { |
| 697 unexpectedNode(node); | 708 unexpectedNode(node); |
| 698 } | 709 } |
| 699 visitParameter(cps_ir.Parameter node) => unexpectedNode(node); | 710 visitParameter(cps_ir.Parameter node) => unexpectedNode(node); |
| 700 visitContinuation(cps_ir.Continuation node) => unexpectedNode(node); | 711 visitContinuation(cps_ir.Continuation node) => unexpectedNode(node); |
| 701 visitMutableVariable(cps_ir.MutableVariable node) => unexpectedNode(node); | 712 visitMutableVariable(cps_ir.MutableVariable node) => unexpectedNode(node); |
| 702 } | 713 } |
| 703 | |
| OLD | NEW |