| 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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 : this.value = new Reference<Primitive>(value); | 645 : this.value = new Reference<Primitive>(value); |
| 646 | 646 |
| 647 Expression plug(Expression expr) { | 647 Expression plug(Expression expr) { |
| 648 assert(body == null); | 648 assert(body == null); |
| 649 return body = expr; | 649 return body = expr; |
| 650 } | 650 } |
| 651 | 651 |
| 652 accept(Visitor visitor) => visitor.visitSetStatic(this); | 652 accept(Visitor visitor) => visitor.visitSetStatic(this); |
| 653 } | 653 } |
| 654 | 654 |
| 655 /// Reads the value of a lazily initialized static field. |
| 656 /// |
| 657 /// If the field has not yet been initialized, its initializer is evaluated |
| 658 /// and assigned to the field. |
| 659 /// |
| 660 /// [continuation] is then invoked with the value of the field as argument. |
| 661 class GetLazyStatic extends Expression { |
| 662 final FieldElement element; |
| 663 final Reference<Continuation> continuation; |
| 664 final SourceInformation sourceInformation; |
| 665 |
| 666 GetLazyStatic(this.element, |
| 667 Continuation cont, |
| 668 this.sourceInformation) |
| 669 : continuation = new Reference<Continuation>(cont); |
| 670 |
| 671 accept(Visitor visitor) => visitor.visitGetLazyStatic(this); |
| 672 } |
| 673 |
| 655 /// Creates an object for holding boxed variables captured by a closure. | 674 /// Creates an object for holding boxed variables captured by a closure. |
| 656 class CreateBox extends Primitive implements JsSpecificNode { | 675 class CreateBox extends Primitive implements JsSpecificNode { |
| 657 accept(Visitor visitor) => visitor.visitCreateBox(this); | 676 accept(Visitor visitor) => visitor.visitCreateBox(this); |
| 658 } | 677 } |
| 659 | 678 |
| 660 /// Creates an instance of a class and initializes its fields and runtime type | 679 /// Creates an instance of a class and initializes its fields and runtime type |
| 661 /// information. | 680 /// information. |
| 662 class CreateInstance extends Primitive implements JsSpecificNode { | 681 class CreateInstance extends Primitive implements JsSpecificNode { |
| 663 final ClassElement classElement; | 682 final ClassElement classElement; |
| 664 | 683 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 class Body extends InteriorNode { | 875 class Body extends InteriorNode { |
| 857 Expression body; | 876 Expression body; |
| 858 final Continuation returnContinuation; | 877 final Continuation returnContinuation; |
| 859 Body(this.body, this.returnContinuation); | 878 Body(this.body, this.returnContinuation); |
| 860 accept(Visitor visitor) => visitor.visitBody(this); | 879 accept(Visitor visitor) => visitor.visitBody(this); |
| 861 } | 880 } |
| 862 | 881 |
| 863 /// A function definition, consisting of parameters and a body. The parameters | 882 /// A function definition, consisting of parameters and a body. The parameters |
| 864 /// include a distinguished continuation parameter (held by the body). | 883 /// include a distinguished continuation parameter (held by the body). |
| 865 class FunctionDefinition extends RootNode { | 884 class FunctionDefinition extends RootNode { |
| 866 final FunctionElement element; | 885 final ExecutableElement element; |
| 867 final Parameter thisParameter; | 886 final Parameter thisParameter; |
| 868 /// Mixed list of [Parameter]s and [MutableVariable]s. | 887 /// Mixed list of [Parameter]s and [MutableVariable]s. |
| 869 final List<Definition> parameters; | 888 final List<Definition> parameters; |
| 870 final Body body; | 889 final Body body; |
| 871 final List<ConstDeclaration> localConstants; | 890 final List<ConstDeclaration> localConstants; |
| 872 | 891 |
| 873 /// Values for optional parameters. | 892 /// Values for optional parameters. |
| 874 final List<ConstantExpression> defaultParameterValues; | 893 final List<ConstantExpression> defaultParameterValues; |
| 875 | 894 |
| 876 FunctionDefinition(this.element, | 895 FunctionDefinition(this.element, |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 T visitInvokeMethodDirectly(InvokeMethodDirectly node); | 1046 T visitInvokeMethodDirectly(InvokeMethodDirectly node); |
| 1028 T visitInvokeConstructor(InvokeConstructor node); | 1047 T visitInvokeConstructor(InvokeConstructor node); |
| 1029 T visitConcatenateStrings(ConcatenateStrings node); | 1048 T visitConcatenateStrings(ConcatenateStrings node); |
| 1030 T visitThrow(Throw node); | 1049 T visitThrow(Throw node); |
| 1031 T visitRethrow(Rethrow node); | 1050 T visitRethrow(Rethrow node); |
| 1032 T visitBranch(Branch node); | 1051 T visitBranch(Branch node); |
| 1033 T visitTypeOperator(TypeOperator node); | 1052 T visitTypeOperator(TypeOperator node); |
| 1034 T visitSetMutableVariable(SetMutableVariable node); | 1053 T visitSetMutableVariable(SetMutableVariable node); |
| 1035 T visitDeclareFunction(DeclareFunction node); | 1054 T visitDeclareFunction(DeclareFunction node); |
| 1036 T visitSetStatic(SetStatic node); | 1055 T visitSetStatic(SetStatic node); |
| 1056 T visitGetLazyStatic(GetLazyStatic node); |
| 1037 | 1057 |
| 1038 // Definitions. | 1058 // Definitions. |
| 1039 T visitLiteralList(LiteralList node); | 1059 T visitLiteralList(LiteralList node); |
| 1040 T visitLiteralMap(LiteralMap node); | 1060 T visitLiteralMap(LiteralMap node); |
| 1041 T visitConstant(Constant node); | 1061 T visitConstant(Constant node); |
| 1042 T visitReifyTypeVar(ReifyTypeVar node); | 1062 T visitReifyTypeVar(ReifyTypeVar node); |
| 1043 T visitCreateFunction(CreateFunction node); | 1063 T visitCreateFunction(CreateFunction node); |
| 1044 T visitGetMutableVariable(GetMutableVariable node); | 1064 T visitGetMutableVariable(GetMutableVariable node); |
| 1045 T visitParameter(Parameter node); | 1065 T visitParameter(Parameter node); |
| 1046 T visitContinuation(Continuation node); | 1066 T visitContinuation(Continuation node); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 } | 1257 } |
| 1238 | 1258 |
| 1239 processDeclareFunction(DeclareFunction node) {} | 1259 processDeclareFunction(DeclareFunction node) {} |
| 1240 visitDeclareFunction(DeclareFunction node) { | 1260 visitDeclareFunction(DeclareFunction node) { |
| 1241 processDeclareFunction(node); | 1261 processDeclareFunction(node); |
| 1242 visit(node.variable); | 1262 visit(node.variable); |
| 1243 visit(node.definition); | 1263 visit(node.definition); |
| 1244 visit(node.body); | 1264 visit(node.body); |
| 1245 } | 1265 } |
| 1246 | 1266 |
| 1267 processGetLazyStatic(GetLazyStatic node) {} |
| 1268 visitGetLazyStatic(GetLazyStatic node) { |
| 1269 processGetLazyStatic(node); |
| 1270 processReference(node.continuation); |
| 1271 } |
| 1272 |
| 1247 // Definitions. | 1273 // Definitions. |
| 1248 | 1274 |
| 1249 processLiteralList(LiteralList node) {} | 1275 processLiteralList(LiteralList node) {} |
| 1250 visitLiteralList(LiteralList node) { | 1276 visitLiteralList(LiteralList node) { |
| 1251 processLiteralList(node); | 1277 processLiteralList(node); |
| 1252 node.values.forEach(processReference); | 1278 node.values.forEach(processReference); |
| 1253 } | 1279 } |
| 1254 | 1280 |
| 1255 processLiteralMap(LiteralMap node) {} | 1281 processLiteralMap(LiteralMap node) {} |
| 1256 visitLiteralMap(LiteralMap node) { | 1282 visitLiteralMap(LiteralMap node) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 processNonTailThrow(node); | 1409 processNonTailThrow(node); |
| 1384 processReference(node.value); | 1410 processReference(node.value); |
| 1385 } | 1411 } |
| 1386 | 1412 |
| 1387 processCreateInvocationMirror(CreateInvocationMirror node) {} | 1413 processCreateInvocationMirror(CreateInvocationMirror node) {} |
| 1388 visitCreateInvocationMirror(CreateInvocationMirror node) { | 1414 visitCreateInvocationMirror(CreateInvocationMirror node) { |
| 1389 processCreateInvocationMirror(node); | 1415 processCreateInvocationMirror(node); |
| 1390 node.arguments.forEach(processReference); | 1416 node.arguments.forEach(processReference); |
| 1391 } | 1417 } |
| 1392 } | 1418 } |
| OLD | NEW |