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 library dart2js.ir_nodes; | 4 library dart2js.ir_nodes; |
5 | 5 |
6 import '../constants/expressions.dart'; | 6 import '../constants/expressions.dart'; |
7 import '../constants/values.dart' as values show ConstantValue; | 7 import '../constants/values.dart' as values show ConstantValue; |
8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; | 8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; |
9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
10 import '../io/source_information.dart' show SourceInformation; | 10 import '../io/source_information.dart' show SourceInformation; |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 final List<Reference<Primitive>> typeInformation; | 697 final List<Reference<Primitive>> typeInformation; |
698 | 698 |
699 CreateInstance(this.classElement, List<Primitive> arguments, | 699 CreateInstance(this.classElement, List<Primitive> arguments, |
700 List<Primitive> typeInformation) | 700 List<Primitive> typeInformation) |
701 : this.arguments = _referenceList(arguments), | 701 : this.arguments = _referenceList(arguments), |
702 this.typeInformation = _referenceList(typeInformation); | 702 this.typeInformation = _referenceList(typeInformation); |
703 | 703 |
704 accept(Visitor visitor) => visitor.visitCreateInstance(this); | 704 accept(Visitor visitor) => visitor.visitCreateInstance(this); |
705 } | 705 } |
706 | 706 |
707 /// Compare objects for identity. | |
708 /// | |
709 /// It is an error pass in a value that does not correspond to a Dart value, | |
710 /// such as an interceptor or a box. | |
711 class Identical extends Primitive { | |
712 final Reference<Primitive> left; | |
713 final Reference<Primitive> right; | |
714 Identical(Primitive left, Primitive right) | |
715 : left = new Reference<Primitive>(left), | |
716 right = new Reference<Primitive>(right); | |
717 accept(Visitor visitor) => visitor.visitIdentical(this); | |
718 } | |
719 | |
720 class Interceptor extends Primitive { | 707 class Interceptor extends Primitive { |
721 final Reference<Primitive> input; | 708 final Reference<Primitive> input; |
722 final Set<ClassElement> interceptedClasses; | 709 final Set<ClassElement> interceptedClasses; |
723 Interceptor(Primitive input, this.interceptedClasses) | 710 Interceptor(Primitive input, this.interceptedClasses) |
724 : this.input = new Reference<Primitive>(input); | 711 : this.input = new Reference<Primitive>(input); |
725 accept(Visitor visitor) => visitor.visitInterceptor(this); | 712 accept(Visitor visitor) => visitor.visitInterceptor(this); |
726 } | 713 } |
727 | 714 |
728 /// Create an instance of [Invocation] for use in a call to `noSuchMethod`. | 715 /// Create an instance of [Invocation] for use in a call to `noSuchMethod`. |
729 class CreateInvocationMirror extends Primitive { | 716 class CreateInvocationMirror extends Primitive { |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 T visitLiteralList(LiteralList node); | 954 T visitLiteralList(LiteralList node); |
968 T visitLiteralMap(LiteralMap node); | 955 T visitLiteralMap(LiteralMap node); |
969 T visitConstant(Constant node); | 956 T visitConstant(Constant node); |
970 T visitCreateFunction(CreateFunction node); | 957 T visitCreateFunction(CreateFunction node); |
971 T visitGetMutableVariable(GetMutableVariable node); | 958 T visitGetMutableVariable(GetMutableVariable node); |
972 T visitParameter(Parameter node); | 959 T visitParameter(Parameter node); |
973 T visitContinuation(Continuation node); | 960 T visitContinuation(Continuation node); |
974 T visitMutableVariable(MutableVariable node); | 961 T visitMutableVariable(MutableVariable node); |
975 T visitNonTailThrow(NonTailThrow node); | 962 T visitNonTailThrow(NonTailThrow node); |
976 T visitGetStatic(GetStatic node); | 963 T visitGetStatic(GetStatic node); |
977 T visitIdentical(Identical node); | |
978 T visitInterceptor(Interceptor node); | 964 T visitInterceptor(Interceptor node); |
979 T visitCreateInstance(CreateInstance node); | 965 T visitCreateInstance(CreateInstance node); |
980 T visitGetField(GetField node); | 966 T visitGetField(GetField node); |
981 T visitCreateBox(CreateBox node); | 967 T visitCreateBox(CreateBox node); |
982 T visitReifyRuntimeType(ReifyRuntimeType node); | 968 T visitReifyRuntimeType(ReifyRuntimeType node); |
983 T visitReadTypeVariable(ReadTypeVariable node); | 969 T visitReadTypeVariable(ReadTypeVariable node); |
984 T visitTypeExpression(TypeExpression node); | 970 T visitTypeExpression(TypeExpression node); |
985 T visitCreateInvocationMirror(CreateInvocationMirror node); | 971 T visitCreateInvocationMirror(CreateInvocationMirror node); |
986 T visitTypeTest(TypeTest node); | 972 T visitTypeTest(TypeTest node); |
987 T visitApplyBuiltinOperator(ApplyBuiltinOperator node); | 973 T visitApplyBuiltinOperator(ApplyBuiltinOperator node); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 node.parameters.forEach(visitParameter); | 1161 node.parameters.forEach(visitParameter); |
1176 if (node.body != null) visit(node.body); | 1162 if (node.body != null) visit(node.body); |
1177 } | 1163 } |
1178 | 1164 |
1179 processIsTrue(IsTrue node) {} | 1165 processIsTrue(IsTrue node) {} |
1180 visitIsTrue(IsTrue node) { | 1166 visitIsTrue(IsTrue node) { |
1181 processIsTrue(node); | 1167 processIsTrue(node); |
1182 processReference(node.value); | 1168 processReference(node.value); |
1183 } | 1169 } |
1184 | 1170 |
1185 processIdentical(Identical node) {} | |
1186 visitIdentical(Identical node) { | |
1187 processIdentical(node); | |
1188 processReference(node.left); | |
1189 processReference(node.right); | |
1190 } | |
1191 | |
1192 processInterceptor(Interceptor node) {} | 1171 processInterceptor(Interceptor node) {} |
1193 visitInterceptor(Interceptor node) { | 1172 visitInterceptor(Interceptor node) { |
1194 processInterceptor(node); | 1173 processInterceptor(node); |
1195 processReference(node.input); | 1174 processReference(node.input); |
1196 } | 1175 } |
1197 | 1176 |
1198 processCreateInstance(CreateInstance node) {} | 1177 processCreateInstance(CreateInstance node) {} |
1199 visitCreateInstance(CreateInstance node) { | 1178 visitCreateInstance(CreateInstance node) { |
1200 processCreateInstance(node); | 1179 processCreateInstance(node); |
1201 node.arguments.forEach(processReference); | 1180 node.arguments.forEach(processReference); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 const RemovalVisitor(); | 1268 const RemovalVisitor(); |
1290 | 1269 |
1291 processReference(Reference reference) { | 1270 processReference(Reference reference) { |
1292 reference.unlink(); | 1271 reference.unlink(); |
1293 } | 1272 } |
1294 | 1273 |
1295 static void remove(Node node) { | 1274 static void remove(Node node) { |
1296 (const RemovalVisitor()).visit(node); | 1275 (const RemovalVisitor()).visit(node); |
1297 } | 1276 } |
1298 } | 1277 } |
OLD | NEW |