| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // IrNodes are kept in a separate library to have precise control over their | 5 // IrNodes are kept in a separate library to have precise control over their |
| 6 // dependencies on other parts of the system. | 6 // dependencies on other parts of the system. |
| 7 library dart2js.ir_nodes; | 7 library dart2js.ir_nodes; |
| 8 | 8 |
| 9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
| 10 import '../constants/values.dart' as values show ConstantValue; | 10 import '../constants/values.dart' as values show ConstantValue; |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 } | 660 } |
| 661 | 661 |
| 662 class Interceptor extends Primitive implements JsSpecificNode { | 662 class Interceptor extends Primitive implements JsSpecificNode { |
| 663 final Reference<Primitive> input; | 663 final Reference<Primitive> input; |
| 664 final Set<ClassElement> interceptedClasses; | 664 final Set<ClassElement> interceptedClasses; |
| 665 Interceptor(Primitive input, this.interceptedClasses) | 665 Interceptor(Primitive input, this.interceptedClasses) |
| 666 : this.input = new Reference<Primitive>(input); | 666 : this.input = new Reference<Primitive>(input); |
| 667 accept(Visitor visitor) => visitor.visitInterceptor(this); | 667 accept(Visitor visitor) => visitor.visitInterceptor(this); |
| 668 } | 668 } |
| 669 | 669 |
| 670 /// Create an instance of [Invocation] for use in a call to `noSuchMethod`. |
| 671 class CreateInvocationMirror extends Primitive implements JsSpecificNode { |
| 672 final Selector selector; |
| 673 final List<Reference<Primitive>> arguments; |
| 674 |
| 675 CreateInvocationMirror(this.selector, List<Primitive> arguments) |
| 676 : this.arguments = _referenceList(arguments); |
| 677 |
| 678 accept(Visitor visitor) => visitor.visitCreateInvocationMirror(this); |
| 679 } |
| 680 |
| 670 class Constant extends Primitive { | 681 class Constant extends Primitive { |
| 671 final ConstantExpression expression; | 682 final ConstantExpression expression; |
| 672 | 683 |
| 673 Constant(this.expression); | 684 Constant(this.expression); |
| 674 | 685 |
| 675 values.ConstantValue get value => expression.value; | 686 values.ConstantValue get value => expression.value; |
| 676 | 687 |
| 677 accept(Visitor visitor) => visitor.visitConstant(this); | 688 accept(Visitor visitor) => visitor.visitConstant(this); |
| 678 } | 689 } |
| 679 | 690 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 | 1025 |
| 1015 // Definitions. | 1026 // Definitions. |
| 1016 T visitIdentical(Identical node); | 1027 T visitIdentical(Identical node); |
| 1017 T visitInterceptor(Interceptor node); | 1028 T visitInterceptor(Interceptor node); |
| 1018 T visitCreateInstance(CreateInstance node); | 1029 T visitCreateInstance(CreateInstance node); |
| 1019 T visitGetField(GetField node); | 1030 T visitGetField(GetField node); |
| 1020 T visitCreateBox(CreateBox node); | 1031 T visitCreateBox(CreateBox node); |
| 1021 T visitReifyRuntimeType(ReifyRuntimeType node); | 1032 T visitReifyRuntimeType(ReifyRuntimeType node); |
| 1022 T visitReadTypeVariable(ReadTypeVariable node); | 1033 T visitReadTypeVariable(ReadTypeVariable node); |
| 1023 T visitTypeExpression(TypeExpression node); | 1034 T visitTypeExpression(TypeExpression node); |
| 1035 T visitCreateInvocationMirror(CreateInvocationMirror node); |
| 1024 } | 1036 } |
| 1025 | 1037 |
| 1026 /// Recursively visits the entire CPS term, and calls abstract `process*` | 1038 /// Recursively visits the entire CPS term, and calls abstract `process*` |
| 1027 /// (i.e. `processLetPrim`) functions in pre-order. | 1039 /// (i.e. `processLetPrim`) functions in pre-order. |
| 1028 class RecursiveVisitor implements Visitor { | 1040 class RecursiveVisitor implements Visitor { |
| 1029 const RecursiveVisitor(); | 1041 const RecursiveVisitor(); |
| 1030 | 1042 |
| 1031 visit(Node node) => node.accept(this); | 1043 visit(Node node) => node.accept(this); |
| 1032 | 1044 |
| 1033 processReference(Reference ref) {} | 1045 processReference(Reference ref) {} |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 visitTypeExpression(TypeExpression node) { | 1331 visitTypeExpression(TypeExpression node) { |
| 1320 processTypeExpression(node); | 1332 processTypeExpression(node); |
| 1321 node.arguments.forEach(processReference); | 1333 node.arguments.forEach(processReference); |
| 1322 } | 1334 } |
| 1323 | 1335 |
| 1324 processNonTailThrow(NonTailThrow node) {} | 1336 processNonTailThrow(NonTailThrow node) {} |
| 1325 visitNonTailThrow(NonTailThrow node) { | 1337 visitNonTailThrow(NonTailThrow node) { |
| 1326 processNonTailThrow(node); | 1338 processNonTailThrow(node); |
| 1327 processReference(node.value); | 1339 processReference(node.value); |
| 1328 } | 1340 } |
| 1341 |
| 1342 processCreateInvocationMirror(CreateInvocationMirror node) {} |
| 1343 visitCreateInvocationMirror(CreateInvocationMirror node) { |
| 1344 processCreateInvocationMirror(node); |
| 1345 node.arguments.forEach(processReference); |
| 1346 } |
| 1329 } | 1347 } |
| OLD | NEW |