| 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 '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../constants/values.dart'; | 8 import '../constants/values.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 '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 node.codeTemplate, | 692 node.codeTemplate, |
| 693 node.type, | 693 node.type, |
| 694 arguments, | 694 arguments, |
| 695 node.nativeBehavior, | 695 node.nativeBehavior, |
| 696 nullableArguments, | 696 nullableArguments, |
| 697 node.dependency); | 697 node.dependency); |
| 698 }; | 698 }; |
| 699 } | 699 } |
| 700 } | 700 } |
| 701 | 701 |
| 702 visitNullCheck(cps_ir.NullCheck node) => (Statement next) { | 702 visitReceiverCheck(cps_ir.ReceiverCheck node) => (Statement next) { |
| 703 return new NullCheck( | 703 // The CPS IR uses 'isNullCheck' because the semantics are important. |
| 704 // In the Tree IR, syntax is more important, so the receiver check uses |
| 705 // "useInvoke" to denote if an invocation should be emitted. |
| 706 return new ReceiverCheck( |
| 704 condition: getVariableUseOrNull(node.condition), | 707 condition: getVariableUseOrNull(node.condition), |
| 705 value: getVariableUse(node.value), | 708 value: getVariableUse(node.value), |
| 706 selector: node.selector, | 709 selector: node.selector, |
| 707 useSelector: node.useSelector, | 710 useSelector: node.useSelector, |
| 711 useInvoke: !node.isNullCheck, |
| 708 next: next, | 712 next: next, |
| 709 sourceInformation: node.sourceInformation); | 713 sourceInformation: node.sourceInformation); |
| 710 }; | 714 }; |
| 711 | 715 |
| 712 Expression visitGetLazyStatic(cps_ir.GetLazyStatic node) { | 716 Expression visitGetLazyStatic(cps_ir.GetLazyStatic node) { |
| 713 return new GetStatic.lazy(node.element, node.sourceInformation); | 717 return new GetStatic.lazy(node.element, node.sourceInformation); |
| 714 } | 718 } |
| 715 | 719 |
| 716 @override | 720 @override |
| 717 NodeCallback visitYield(cps_ir.Yield node) { | 721 NodeCallback visitYield(cps_ir.Yield node) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 738 | 742 |
| 739 visitFunctionDefinition(cps_ir.FunctionDefinition node) { | 743 visitFunctionDefinition(cps_ir.FunctionDefinition node) { |
| 740 unexpectedNode(node); | 744 unexpectedNode(node); |
| 741 } | 745 } |
| 742 visitParameter(cps_ir.Parameter node) => unexpectedNode(node); | 746 visitParameter(cps_ir.Parameter node) => unexpectedNode(node); |
| 743 visitContinuation(cps_ir.Continuation node) => unexpectedNode(node); | 747 visitContinuation(cps_ir.Continuation node) => unexpectedNode(node); |
| 744 visitMutableVariable(cps_ir.MutableVariable node) => unexpectedNode(node); | 748 visitMutableVariable(cps_ir.MutableVariable node) => unexpectedNode(node); |
| 745 visitRethrow(cps_ir.Rethrow node) => unexpectedNode(node); | 749 visitRethrow(cps_ir.Rethrow node) => unexpectedNode(node); |
| 746 visitBoundsCheck(cps_ir.BoundsCheck node) => unexpectedNode(node); | 750 visitBoundsCheck(cps_ir.BoundsCheck node) => unexpectedNode(node); |
| 747 } | 751 } |
| OLD | NEW |