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 visitTypeTestViaFlag(cps_ir.TypeTestViaFlag node) { |
| 645 Expression value = getVariableUse(node.interceptor); |
| 646 // TODO(sra): Move !! to cps_ir level. |
| 647 return new Not(new Not(new GetTypeTestProperty(value, node.dartType))); |
| 648 } |
| 649 |
644 Expression visitGetStatic(cps_ir.GetStatic node) { | 650 Expression visitGetStatic(cps_ir.GetStatic node) { |
645 return new GetStatic(node.element, node.sourceInformation); | 651 return new GetStatic(node.element, node.sourceInformation); |
646 } | 652 } |
647 | 653 |
648 Expression visitSetStatic(cps_ir.SetStatic node) { | 654 Expression visitSetStatic(cps_ir.SetStatic node) { |
649 return new SetStatic( | 655 return new SetStatic( |
650 node.element, | 656 node.element, |
651 getVariableUse(node.value), | 657 getVariableUse(node.value), |
652 node.sourceInformation); | 658 node.sourceInformation); |
653 } | 659 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 internalError(CURRENT_ELEMENT_SPANNABLE, 'Unexpected IR node: $node'); | 699 internalError(CURRENT_ELEMENT_SPANNABLE, 'Unexpected IR node: $node'); |
694 } | 700 } |
695 | 701 |
696 visitFunctionDefinition(cps_ir.FunctionDefinition node) { | 702 visitFunctionDefinition(cps_ir.FunctionDefinition node) { |
697 unexpectedNode(node); | 703 unexpectedNode(node); |
698 } | 704 } |
699 visitParameter(cps_ir.Parameter node) => unexpectedNode(node); | 705 visitParameter(cps_ir.Parameter node) => unexpectedNode(node); |
700 visitContinuation(cps_ir.Continuation node) => unexpectedNode(node); | 706 visitContinuation(cps_ir.Continuation node) => unexpectedNode(node); |
701 visitMutableVariable(cps_ir.MutableVariable node) => unexpectedNode(node); | 707 visitMutableVariable(cps_ir.MutableVariable node) => unexpectedNode(node); |
702 } | 708 } |
703 | |
OLD | NEW |