| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 /// Node child = node.body; | 207 /// Node child = node.body; |
| 208 /// InteriorNode parent = node.parent; | 208 /// InteriorNode parent = node.parent; |
| 209 /// | 209 /// |
| 210 /// child.parent = parent; | 210 /// child.parent = parent; |
| 211 /// parent.body = child; | 211 /// parent.body = child; |
| 212 abstract class InteriorNode extends Node { | 212 abstract class InteriorNode extends Node { |
| 213 Expression get body; | 213 Expression get body; |
| 214 void set body(Expression body); | 214 void set body(Expression body); |
| 215 } | 215 } |
| 216 | 216 |
| 217 /// Invoke a static function or static field getter/setter. | 217 /// Invoke a static function or static getter/setter. |
| 218 class InvokeStatic extends Expression implements Invoke { | 218 class InvokeStatic extends Expression implements Invoke { |
| 219 /// [FunctionElement] or [FieldElement]. | 219 /// [FunctionElement] or [FieldElement]. |
| 220 final Entity target; | 220 final Entity target; |
| 221 | 221 |
| 222 /** | 222 /** |
| 223 * The selector encodes how the function is invoked: number of positional | 223 * The selector encodes how the function is invoked: number of positional |
| 224 * arguments, names used in named arguments. This information is required | 224 * arguments, names used in named arguments. This information is required |
| 225 * to build the [StaticCallSiteTypeInformation] for the inference graph. | 225 * to build the [StaticCallSiteTypeInformation] for the inference graph. |
| 226 */ | 226 */ |
| 227 final Selector selector; | 227 final Selector selector; |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 class GetField extends Primitive implements JsSpecificNode { | 617 class GetField extends Primitive implements JsSpecificNode { |
| 618 final Reference<Primitive> object; | 618 final Reference<Primitive> object; |
| 619 Element field; | 619 Element field; |
| 620 | 620 |
| 621 GetField(Primitive object, this.field) | 621 GetField(Primitive object, this.field) |
| 622 : this.object = new Reference<Primitive>(object); | 622 : this.object = new Reference<Primitive>(object); |
| 623 | 623 |
| 624 accept(Visitor visitor) => visitor.visitGetField(this); | 624 accept(Visitor visitor) => visitor.visitGetField(this); |
| 625 } | 625 } |
| 626 | 626 |
| 627 /// Reads the value of a static field or tears off a static method. |
| 628 class GetStatic extends Primitive { |
| 629 final Element element; |
| 630 final SourceInformation sourceInformation; |
| 631 |
| 632 GetStatic(this.element, this.sourceInformation); |
| 633 |
| 634 accept(Visitor visitor) => visitor.visitGetStatic(this); |
| 635 } |
| 636 |
| 637 /// Sets the value of a static field. |
| 638 class SetStatic extends Expression implements InteriorNode { |
| 639 final Element element; |
| 640 final Reference<Primitive> value; |
| 641 Expression body; |
| 642 final SourceInformation sourceInformation; |
| 643 |
| 644 SetStatic(this.element, Primitive value, this.sourceInformation) |
| 645 : this.value = new Reference<Primitive>(value); |
| 646 |
| 647 Expression plug(Expression expr) { |
| 648 assert(body == null); |
| 649 return body = expr; |
| 650 } |
| 651 |
| 652 accept(Visitor visitor) => visitor.visitSetStatic(this); |
| 653 } |
| 654 |
| 627 /// Creates an object for holding boxed variables captured by a closure. | 655 /// Creates an object for holding boxed variables captured by a closure. |
| 628 class CreateBox extends Primitive implements JsSpecificNode { | 656 class CreateBox extends Primitive implements JsSpecificNode { |
| 629 accept(Visitor visitor) => visitor.visitCreateBox(this); | 657 accept(Visitor visitor) => visitor.visitCreateBox(this); |
| 630 } | 658 } |
| 631 | 659 |
| 632 /// Creates an instance of a class and initializes its fields and runtime type | 660 /// Creates an instance of a class and initializes its fields and runtime type |
| 633 /// information. | 661 /// information. |
| 634 class CreateInstance extends Primitive implements JsSpecificNode { | 662 class CreateInstance extends Primitive implements JsSpecificNode { |
| 635 final ClassElement classElement; | 663 final ClassElement classElement; |
| 636 | 664 |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 T visitInvokeMethod(InvokeMethod node); | 1026 T visitInvokeMethod(InvokeMethod node); |
| 999 T visitInvokeMethodDirectly(InvokeMethodDirectly node); | 1027 T visitInvokeMethodDirectly(InvokeMethodDirectly node); |
| 1000 T visitInvokeConstructor(InvokeConstructor node); | 1028 T visitInvokeConstructor(InvokeConstructor node); |
| 1001 T visitConcatenateStrings(ConcatenateStrings node); | 1029 T visitConcatenateStrings(ConcatenateStrings node); |
| 1002 T visitThrow(Throw node); | 1030 T visitThrow(Throw node); |
| 1003 T visitRethrow(Rethrow node); | 1031 T visitRethrow(Rethrow node); |
| 1004 T visitBranch(Branch node); | 1032 T visitBranch(Branch node); |
| 1005 T visitTypeOperator(TypeOperator node); | 1033 T visitTypeOperator(TypeOperator node); |
| 1006 T visitSetMutableVariable(SetMutableVariable node); | 1034 T visitSetMutableVariable(SetMutableVariable node); |
| 1007 T visitDeclareFunction(DeclareFunction node); | 1035 T visitDeclareFunction(DeclareFunction node); |
| 1036 T visitSetStatic(SetStatic node); |
| 1008 | 1037 |
| 1009 // Definitions. | 1038 // Definitions. |
| 1010 T visitLiteralList(LiteralList node); | 1039 T visitLiteralList(LiteralList node); |
| 1011 T visitLiteralMap(LiteralMap node); | 1040 T visitLiteralMap(LiteralMap node); |
| 1012 T visitConstant(Constant node); | 1041 T visitConstant(Constant node); |
| 1013 T visitReifyTypeVar(ReifyTypeVar node); | 1042 T visitReifyTypeVar(ReifyTypeVar node); |
| 1014 T visitCreateFunction(CreateFunction node); | 1043 T visitCreateFunction(CreateFunction node); |
| 1015 T visitGetMutableVariable(GetMutableVariable node); | 1044 T visitGetMutableVariable(GetMutableVariable node); |
| 1016 T visitParameter(Parameter node); | 1045 T visitParameter(Parameter node); |
| 1017 T visitContinuation(Continuation node); | 1046 T visitContinuation(Continuation node); |
| 1018 T visitMutableVariable(MutableVariable node); | 1047 T visitMutableVariable(MutableVariable node); |
| 1019 T visitNonTailThrow(NonTailThrow node); | 1048 T visitNonTailThrow(NonTailThrow node); |
| 1049 T visitGetStatic(GetStatic node); |
| 1020 | 1050 |
| 1021 // JavaScript specific nodes. | 1051 // JavaScript specific nodes. |
| 1022 | 1052 |
| 1023 // Conditions. | 1053 // Conditions. |
| 1024 T visitIsTrue(IsTrue node); | 1054 T visitIsTrue(IsTrue node); |
| 1025 | 1055 |
| 1026 // Expressions. | 1056 // Expressions. |
| 1027 T visitSetField(SetField node); | 1057 T visitSetField(SetField node); |
| 1028 | 1058 |
| 1029 // Definitions. | 1059 // Definitions. |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 processReference(node.value); | 1336 processReference(node.value); |
| 1307 visit(node.body); | 1337 visit(node.body); |
| 1308 } | 1338 } |
| 1309 | 1339 |
| 1310 processGetField(GetField node) {} | 1340 processGetField(GetField node) {} |
| 1311 visitGetField(GetField node) { | 1341 visitGetField(GetField node) { |
| 1312 processGetField(node); | 1342 processGetField(node); |
| 1313 processReference(node.object); | 1343 processReference(node.object); |
| 1314 } | 1344 } |
| 1315 | 1345 |
| 1346 processGetStatic(GetStatic node) {} |
| 1347 visitGetStatic(GetStatic node) { |
| 1348 processGetStatic(node); |
| 1349 } |
| 1350 |
| 1351 processSetStatic(SetStatic node) {} |
| 1352 visitSetStatic(SetStatic node) { |
| 1353 processSetStatic(node); |
| 1354 processReference(node.value); |
| 1355 visit(node.body); |
| 1356 } |
| 1357 |
| 1316 processCreateBox(CreateBox node) {} | 1358 processCreateBox(CreateBox node) {} |
| 1317 visitCreateBox(CreateBox node) { | 1359 visitCreateBox(CreateBox node) { |
| 1318 processCreateBox(node); | 1360 processCreateBox(node); |
| 1319 } | 1361 } |
| 1320 | 1362 |
| 1321 processReifyRuntimeType(ReifyRuntimeType node) {} | 1363 processReifyRuntimeType(ReifyRuntimeType node) {} |
| 1322 visitReifyRuntimeType(ReifyRuntimeType node) { | 1364 visitReifyRuntimeType(ReifyRuntimeType node) { |
| 1323 processReifyRuntimeType(node); | 1365 processReifyRuntimeType(node); |
| 1324 processReference(node.value); | 1366 processReference(node.value); |
| 1325 } | 1367 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1341 processNonTailThrow(node); | 1383 processNonTailThrow(node); |
| 1342 processReference(node.value); | 1384 processReference(node.value); |
| 1343 } | 1385 } |
| 1344 | 1386 |
| 1345 processCreateInvocationMirror(CreateInvocationMirror node) {} | 1387 processCreateInvocationMirror(CreateInvocationMirror node) {} |
| 1346 visitCreateInvocationMirror(CreateInvocationMirror node) { | 1388 visitCreateInvocationMirror(CreateInvocationMirror node) { |
| 1347 processCreateInvocationMirror(node); | 1389 processCreateInvocationMirror(node); |
| 1348 node.arguments.forEach(processReference); | 1390 node.arguments.forEach(processReference); |
| 1349 } | 1391 } |
| 1350 } | 1392 } |
| OLD | NEW |