| 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_nodes; | 5 library tree_ir_nodes; |
| 6 | 6 |
| 7 import '../constants/expressions.dart'; | 7 import '../constants/expressions.dart'; |
| 8 import '../constants/values.dart' as values; | 8 import '../constants/values.dart' as values; |
| 9 import '../dart_types.dart' show DartType, GenericType, InterfaceType, TypeVaria
bleType; | 9 import '../dart_types.dart' show DartType, GenericType, InterfaceType, TypeVaria
bleType; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 */ | 35 */ |
| 36 abstract class Node { | 36 abstract class Node { |
| 37 } | 37 } |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * The base class of [Expression]s. | 40 * The base class of [Expression]s. |
| 41 */ | 41 */ |
| 42 abstract class Expression extends Node { | 42 abstract class Expression extends Node { |
| 43 accept(ExpressionVisitor v); | 43 accept(ExpressionVisitor v); |
| 44 accept1(ExpressionVisitor1 v, arg); | 44 accept1(ExpressionVisitor1 v, arg); |
| 45 | |
| 46 /// Temporary variable used by [StatementRewriter]. | |
| 47 /// If set to true, this expression has already had enclosing assignments | |
| 48 /// propagated into its variables, and should not be processed again. | |
| 49 /// It is only set for expressions that are known to be in risk of redundant | |
| 50 /// processing. | |
| 51 bool processed = false; | |
| 52 } | 45 } |
| 53 | 46 |
| 54 abstract class Statement extends Node { | 47 abstract class Statement extends Node { |
| 55 Statement get next; | 48 Statement get next; |
| 56 void set next(Statement s); | 49 void set next(Statement s); |
| 57 accept(StatementVisitor v); | 50 accept(StatementVisitor v); |
| 58 accept1(StatementVisitor1 v, arg); | 51 accept1(StatementVisitor1 v, arg); |
| 59 } | 52 } |
| 60 | 53 |
| 61 /** | 54 /** |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 VariableUse(this.variable) { | 129 VariableUse(this.variable) { |
| 137 variable.readCount++; | 130 variable.readCount++; |
| 138 } | 131 } |
| 139 | 132 |
| 140 accept(ExpressionVisitor visitor) => visitor.visitVariableUse(this); | 133 accept(ExpressionVisitor visitor) => visitor.visitVariableUse(this); |
| 141 accept1(ExpressionVisitor1 visitor, arg) { | 134 accept1(ExpressionVisitor1 visitor, arg) { |
| 142 return visitor.visitVariableUse(this, arg); | 135 return visitor.visitVariableUse(this, arg); |
| 143 } | 136 } |
| 144 } | 137 } |
| 145 | 138 |
| 139 class Assign extends Expression { |
| 140 Variable variable; |
| 141 Expression value; |
| 142 |
| 143 Assign(this.variable, this.value) { |
| 144 variable.writeCount++; |
| 145 } |
| 146 |
| 147 accept(ExpressionVisitor v) => v.visitAssign(this); |
| 148 accept1(ExpressionVisitor1 v, arg) => v.visitAssign(this, arg); |
| 149 |
| 150 static ExpressionStatement makeStatement(Variable variable, |
| 151 Expression value, |
| 152 [Statement next]) { |
| 153 return new ExpressionStatement(new Assign(variable, value), next); |
| 154 } |
| 155 } |
| 156 |
| 146 /** | 157 /** |
| 147 * Common interface for invocations with arguments. | 158 * Common interface for invocations with arguments. |
| 148 */ | 159 */ |
| 149 abstract class Invoke { | 160 abstract class Invoke { |
| 150 List<Expression> get arguments; | 161 List<Expression> get arguments; |
| 151 Selector get selector; | 162 Selector get selector; |
| 152 } | 163 } |
| 153 | 164 |
| 154 /** | 165 /** |
| 155 * A call to a static function or getter/setter to a static field. | 166 * A call to a static function or getter/setter to a static field. |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 void set next(Statement s) => throw 'UNREACHABLE'; | 523 void set next(Statement s) => throw 'UNREACHABLE'; |
| 513 | 524 |
| 514 Continue(this.target) { | 525 Continue(this.target) { |
| 515 ++target.useCount; | 526 ++target.useCount; |
| 516 } | 527 } |
| 517 | 528 |
| 518 accept(StatementVisitor visitor) => visitor.visitContinue(this); | 529 accept(StatementVisitor visitor) => visitor.visitContinue(this); |
| 519 accept1(StatementVisitor1 visitor, arg) => visitor.visitContinue(this, arg); | 530 accept1(StatementVisitor1 visitor, arg) => visitor.visitContinue(this, arg); |
| 520 } | 531 } |
| 521 | 532 |
| 522 /** | 533 /// Declares a captured [variable] with an initial [value]. |
| 523 * An assignments of an [Expression] to a [Variable]. | 534 /// |
| 524 * | 535 /// All uses of the variable must be inside the [next] statement. |
| 525 * In contrast to the CPS-based IR, non-primitive expressions can be assigned | 536 class VariableDeclaration extends Statement implements DartSpecificNode { |
| 526 * to variables. | |
| 527 */ | |
| 528 class Assign extends Statement { | |
| 529 Statement next; | |
| 530 Variable variable; | 537 Variable variable; |
| 531 Expression value; | 538 Expression value; |
| 539 Statement next; |
| 532 | 540 |
| 533 /// If true, this assignes to a fresh variable scoped to the [next] | 541 VariableDeclaration(this.variable, this.value, this.next) { |
| 534 /// statement. | 542 assert(variable.isCaptured); // Because otherwise no declaration is needed. |
| 535 /// | 543 ++variable.writeCount; |
| 536 /// Variable declarations themselves are hoisted to function level. | |
| 537 bool isDeclaration; | |
| 538 | |
| 539 /// Creates an assignment to [variable] and updates its `writeCount`. | |
| 540 Assign(this.variable, this.value, this.next, | |
| 541 { this.isDeclaration: false }) { | |
| 542 variable.writeCount++; | |
| 543 } | 544 } |
| 544 | 545 |
| 545 bool get hasExactlyOneUse => variable.readCount == 1; | 546 accept(StatementVisitor visitor) { |
| 547 return visitor.visitVariableDeclaration(this); |
| 548 } |
| 546 | 549 |
| 547 accept(StatementVisitor visitor) => visitor.visitAssign(this); | 550 accept1(StatementVisitor1 visitor, arg) { |
| 548 accept1(StatementVisitor1 visitor, arg) => visitor.visitAssign(this, arg); | 551 return visitor.visitVariableDeclaration(this, arg); |
| 552 } |
| 549 } | 553 } |
| 550 | 554 |
| 551 /** | 555 /** |
| 552 * A return exit from the function. | 556 * A return exit from the function. |
| 553 * | 557 * |
| 554 * In contrast to the CPS-based IR, the return value is an arbitrary | 558 * In contrast to the CPS-based IR, the return value is an arbitrary |
| 555 * expression. | 559 * expression. |
| 556 */ | 560 */ |
| 557 class Return extends Statement { | 561 class Return extends Statement { |
| 558 /// Should not be null. Use [Constant] with [NullConstantValue] for void | 562 /// Should not be null. Use [Constant] with [NullConstantValue] for void |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 class GetField extends Expression implements JsSpecificNode { | 815 class GetField extends Expression implements JsSpecificNode { |
| 812 Expression object; | 816 Expression object; |
| 813 Element field; | 817 Element field; |
| 814 | 818 |
| 815 GetField(this.object, this.field); | 819 GetField(this.object, this.field); |
| 816 | 820 |
| 817 accept(ExpressionVisitor visitor) => visitor.visitGetField(this); | 821 accept(ExpressionVisitor visitor) => visitor.visitGetField(this); |
| 818 accept1(ExpressionVisitor1 visitor, arg) => visitor.visitGetField(this, arg); | 822 accept1(ExpressionVisitor1 visitor, arg) => visitor.visitGetField(this, arg); |
| 819 } | 823 } |
| 820 | 824 |
| 821 class SetField extends Statement implements JsSpecificNode { | 825 class SetField extends Expression implements JsSpecificNode { |
| 822 Expression object; | 826 Expression object; |
| 823 Element field; | 827 Element field; |
| 824 Expression value; | 828 Expression value; |
| 825 Statement next; | |
| 826 | 829 |
| 827 SetField(this.object, this.field, this.value, this.next); | 830 SetField(this.object, this.field, this.value); |
| 828 | 831 |
| 829 accept(StatementVisitor visitor) => visitor.visitSetField(this); | 832 accept(ExpressionVisitor visitor) => visitor.visitSetField(this); |
| 830 accept1(StatementVisitor1 visitor, arg) => visitor.visitSetField(this, arg); | 833 accept1(ExpressionVisitor1 visitor, arg) => visitor.visitSetField(this, arg); |
| 831 } | 834 } |
| 832 | 835 |
| 833 class ReifyRuntimeType extends Expression implements JsSpecificNode { | 836 class ReifyRuntimeType extends Expression implements JsSpecificNode { |
| 834 Expression value; | 837 Expression value; |
| 835 | 838 |
| 836 ReifyRuntimeType(this.value); | 839 ReifyRuntimeType(this.value); |
| 837 | 840 |
| 838 accept(ExpressionVisitor visitor) { | 841 accept(ExpressionVisitor visitor) { |
| 839 return visitor.visitReifyRuntimeType(this); | 842 return visitor.visitReifyRuntimeType(this); |
| 840 } | 843 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 } | 876 } |
| 874 | 877 |
| 875 accept1(ExpressionVisitor1 visitor, arg) { | 878 accept1(ExpressionVisitor1 visitor, arg) { |
| 876 return visitor.visitTypeExpression(this, arg); | 879 return visitor.visitTypeExpression(this, arg); |
| 877 } | 880 } |
| 878 } | 881 } |
| 879 | 882 |
| 880 abstract class ExpressionVisitor<E> { | 883 abstract class ExpressionVisitor<E> { |
| 881 E visitExpression(Expression node) => node.accept(this); | 884 E visitExpression(Expression node) => node.accept(this); |
| 882 E visitVariableUse(VariableUse node); | 885 E visitVariableUse(VariableUse node); |
| 886 E visitAssign(Assign node); |
| 883 E visitInvokeStatic(InvokeStatic node); | 887 E visitInvokeStatic(InvokeStatic node); |
| 884 E visitInvokeMethod(InvokeMethod node); | 888 E visitInvokeMethod(InvokeMethod node); |
| 885 E visitInvokeMethodDirectly(InvokeMethodDirectly node); | 889 E visitInvokeMethodDirectly(InvokeMethodDirectly node); |
| 886 E visitInvokeConstructor(InvokeConstructor node); | 890 E visitInvokeConstructor(InvokeConstructor node); |
| 887 E visitConcatenateStrings(ConcatenateStrings node); | 891 E visitConcatenateStrings(ConcatenateStrings node); |
| 888 E visitConstant(Constant node); | 892 E visitConstant(Constant node); |
| 889 E visitThis(This node); | 893 E visitThis(This node); |
| 890 E visitReifyTypeVar(ReifyTypeVar node); | 894 E visitReifyTypeVar(ReifyTypeVar node); |
| 891 E visitConditional(Conditional node); | 895 E visitConditional(Conditional node); |
| 892 E visitLogicalOperator(LogicalOperator node); | 896 E visitLogicalOperator(LogicalOperator node); |
| 893 E visitNot(Not node); | 897 E visitNot(Not node); |
| 894 E visitLiteralList(LiteralList node); | 898 E visitLiteralList(LiteralList node); |
| 895 E visitLiteralMap(LiteralMap node); | 899 E visitLiteralMap(LiteralMap node); |
| 896 E visitTypeOperator(TypeOperator node); | 900 E visitTypeOperator(TypeOperator node); |
| 897 E visitFunctionExpression(FunctionExpression node); | 901 E visitFunctionExpression(FunctionExpression node); |
| 898 E visitGetField(GetField node); | 902 E visitGetField(GetField node); |
| 899 E visitCreateBox(CreateBox node); | 903 E visitCreateBox(CreateBox node); |
| 900 E visitCreateInstance(CreateInstance node); | 904 E visitCreateInstance(CreateInstance node); |
| 901 E visitReifyRuntimeType(ReifyRuntimeType node); | 905 E visitReifyRuntimeType(ReifyRuntimeType node); |
| 902 E visitReadTypeVariable(ReadTypeVariable node); | 906 E visitReadTypeVariable(ReadTypeVariable node); |
| 903 E visitTypeExpression(TypeExpression node); | 907 E visitTypeExpression(TypeExpression node); |
| 908 E visitSetField(SetField node); |
| 904 } | 909 } |
| 905 | 910 |
| 906 abstract class ExpressionVisitor1<E, A> { | 911 abstract class ExpressionVisitor1<E, A> { |
| 907 E visitExpression(Expression node, A arg) => node.accept1(this, arg); | 912 E visitExpression(Expression node, A arg) => node.accept1(this, arg); |
| 908 E visitVariableUse(VariableUse node, A arg); | 913 E visitVariableUse(VariableUse node, A arg); |
| 914 E visitAssign(Assign node, A arg); |
| 909 E visitInvokeStatic(InvokeStatic node, A arg); | 915 E visitInvokeStatic(InvokeStatic node, A arg); |
| 910 E visitInvokeMethod(InvokeMethod node, A arg); | 916 E visitInvokeMethod(InvokeMethod node, A arg); |
| 911 E visitInvokeMethodDirectly(InvokeMethodDirectly node, A arg); | 917 E visitInvokeMethodDirectly(InvokeMethodDirectly node, A arg); |
| 912 E visitInvokeConstructor(InvokeConstructor node, A arg); | 918 E visitInvokeConstructor(InvokeConstructor node, A arg); |
| 913 E visitConcatenateStrings(ConcatenateStrings node, A arg); | 919 E visitConcatenateStrings(ConcatenateStrings node, A arg); |
| 914 E visitConstant(Constant node, A arg); | 920 E visitConstant(Constant node, A arg); |
| 915 E visitThis(This node, A arg); | 921 E visitThis(This node, A arg); |
| 916 E visitReifyTypeVar(ReifyTypeVar node, A arg); | 922 E visitReifyTypeVar(ReifyTypeVar node, A arg); |
| 917 E visitConditional(Conditional node, A arg); | 923 E visitConditional(Conditional node, A arg); |
| 918 E visitLogicalOperator(LogicalOperator node, A arg); | 924 E visitLogicalOperator(LogicalOperator node, A arg); |
| 919 E visitNot(Not node, A arg); | 925 E visitNot(Not node, A arg); |
| 920 E visitLiteralList(LiteralList node, A arg); | 926 E visitLiteralList(LiteralList node, A arg); |
| 921 E visitLiteralMap(LiteralMap node, A arg); | 927 E visitLiteralMap(LiteralMap node, A arg); |
| 922 E visitTypeOperator(TypeOperator node, A arg); | 928 E visitTypeOperator(TypeOperator node, A arg); |
| 923 E visitFunctionExpression(FunctionExpression node, A arg); | 929 E visitFunctionExpression(FunctionExpression node, A arg); |
| 924 E visitGetField(GetField node, A arg); | 930 E visitGetField(GetField node, A arg); |
| 925 E visitCreateBox(CreateBox node, A arg); | 931 E visitCreateBox(CreateBox node, A arg); |
| 926 E visitCreateInstance(CreateInstance node, A arg); | 932 E visitCreateInstance(CreateInstance node, A arg); |
| 927 E visitReifyRuntimeType(ReifyRuntimeType node, A arg); | 933 E visitReifyRuntimeType(ReifyRuntimeType node, A arg); |
| 928 E visitReadTypeVariable(ReadTypeVariable node, A arg); | 934 E visitReadTypeVariable(ReadTypeVariable node, A arg); |
| 929 E visitTypeExpression(TypeExpression node, A arg); | 935 E visitTypeExpression(TypeExpression node, A arg); |
| 936 E visitSetField(SetField node, A arg); |
| 930 } | 937 } |
| 931 | 938 |
| 932 abstract class StatementVisitor<S> { | 939 abstract class StatementVisitor<S> { |
| 933 S visitStatement(Statement node) => node.accept(this); | 940 S visitStatement(Statement node) => node.accept(this); |
| 934 S visitLabeledStatement(LabeledStatement node); | 941 S visitLabeledStatement(LabeledStatement node); |
| 935 S visitAssign(Assign node); | |
| 936 S visitReturn(Return node); | 942 S visitReturn(Return node); |
| 937 S visitBreak(Break node); | 943 S visitBreak(Break node); |
| 938 S visitContinue(Continue node); | 944 S visitContinue(Continue node); |
| 939 S visitIf(If node); | 945 S visitIf(If node); |
| 940 S visitWhileTrue(WhileTrue node); | 946 S visitWhileTrue(WhileTrue node); |
| 941 S visitWhileCondition(WhileCondition node); | 947 S visitWhileCondition(WhileCondition node); |
| 942 S visitFunctionDeclaration(FunctionDeclaration node); | 948 S visitFunctionDeclaration(FunctionDeclaration node); |
| 949 S visitVariableDeclaration(VariableDeclaration node); |
| 943 S visitExpressionStatement(ExpressionStatement node); | 950 S visitExpressionStatement(ExpressionStatement node); |
| 944 S visitTry(Try node); | 951 S visitTry(Try node); |
| 945 S visitSetField(SetField node); | |
| 946 } | 952 } |
| 947 | 953 |
| 948 abstract class StatementVisitor1<S, A> { | 954 abstract class StatementVisitor1<S, A> { |
| 949 S visitStatement(Statement node, A arg) => node.accept1(this, arg); | 955 S visitStatement(Statement node, A arg) => node.accept1(this, arg); |
| 950 S visitLabeledStatement(LabeledStatement node, A arg); | 956 S visitLabeledStatement(LabeledStatement node, A arg); |
| 951 S visitAssign(Assign node, A arg); | |
| 952 S visitReturn(Return node, A arg); | 957 S visitReturn(Return node, A arg); |
| 953 S visitBreak(Break node, A arg); | 958 S visitBreak(Break node, A arg); |
| 954 S visitContinue(Continue node, A arg); | 959 S visitContinue(Continue node, A arg); |
| 955 S visitIf(If node, A arg); | 960 S visitIf(If node, A arg); |
| 956 S visitWhileTrue(WhileTrue node, A arg); | 961 S visitWhileTrue(WhileTrue node, A arg); |
| 957 S visitWhileCondition(WhileCondition node, A arg); | 962 S visitWhileCondition(WhileCondition node, A arg); |
| 958 S visitFunctionDeclaration(FunctionDeclaration node, A arg); | 963 S visitFunctionDeclaration(FunctionDeclaration node, A arg); |
| 964 S visitVariableDeclaration(VariableDeclaration node, A arg); |
| 959 S visitExpressionStatement(ExpressionStatement node, A arg); | 965 S visitExpressionStatement(ExpressionStatement node, A arg); |
| 960 S visitTry(Try node, A arg); | 966 S visitTry(Try node, A arg); |
| 961 S visitSetField(SetField node, A arg); | |
| 962 } | 967 } |
| 963 | 968 |
| 964 abstract class RootVisitor<T> { | 969 abstract class RootVisitor<T> { |
| 965 T visitRootNode(RootNode node) => node.accept(this); | 970 T visitRootNode(RootNode node) => node.accept(this); |
| 966 T visitFunctionDefinition(FunctionDefinition node); | 971 T visitFunctionDefinition(FunctionDefinition node); |
| 967 T visitConstructorDefinition(ConstructorDefinition node); | 972 T visitConstructorDefinition(ConstructorDefinition node); |
| 968 T visitFieldDefinition(FieldDefinition node); | 973 T visitFieldDefinition(FieldDefinition node); |
| 969 } | 974 } |
| 970 | 975 |
| 971 abstract class RootVisitor1<T, A> { | 976 abstract class RootVisitor1<T, A> { |
| 972 T visitRootNode(RootNode node, A arg) => node.accept1(this, arg); | 977 T visitRootNode(RootNode node, A arg) => node.accept1(this, arg); |
| 973 T visitFunctionDefinition(FunctionDefinition node, A arg); | 978 T visitFunctionDefinition(FunctionDefinition node, A arg); |
| 974 T visitConstructorDefinition(ConstructorDefinition node, A arg); | 979 T visitConstructorDefinition(ConstructorDefinition node, A arg); |
| 975 T visitFieldDefinition(FieldDefinition node, A arg); | 980 T visitFieldDefinition(FieldDefinition node, A arg); |
| 976 } | 981 } |
| 977 | 982 |
| 978 abstract class InitializerVisitor<T> { | 983 abstract class InitializerVisitor<T> { |
| 979 T visitInitializer(Initializer node) => node.accept(this); | 984 T visitInitializer(Initializer node) => node.accept(this); |
| 980 T visitFieldInitializer(FieldInitializer node); | 985 T visitFieldInitializer(FieldInitializer node); |
| 981 T visitSuperInitializer(SuperInitializer node); | 986 T visitSuperInitializer(SuperInitializer node); |
| 982 } | 987 } |
| 983 | 988 |
| 989 |
| 984 abstract class InitializerVisitor1<T, A> { | 990 abstract class InitializerVisitor1<T, A> { |
| 985 T visitInitializer(Initializer node, A arg) => node.accept1(this, arg); | 991 T visitInitializer(Initializer node, A arg) => node.accept1(this, arg); |
| 986 T visitFieldInitializer(FieldInitializer node, A arg); | 992 T visitFieldInitializer(FieldInitializer node, A arg); |
| 987 T visitSuperInitializer(SuperInitializer node, A arg); | 993 T visitSuperInitializer(SuperInitializer node, A arg); |
| 988 } | 994 } |
| 989 | 995 |
| 990 abstract class RecursiveVisitor implements StatementVisitor, ExpressionVisitor { | 996 abstract class RecursiveVisitor implements StatementVisitor, ExpressionVisitor { |
| 991 visitExpression(Expression e) => e.accept(this); | 997 visitExpression(Expression e) => e.accept(this); |
| 992 visitStatement(Statement s) => s.accept(this); | 998 visitStatement(Statement s) => s.accept(this); |
| 993 | 999 |
| 994 visitInnerFunction(FunctionDefinition node); | 1000 visitInnerFunction(FunctionDefinition node); |
| 995 | 1001 |
| 996 visitVariable(Variable node) {} | 1002 visitVariable(Variable variable) {} |
| 997 | 1003 |
| 998 visitVariableUse(VariableUse node) { | 1004 visitVariableUse(VariableUse node) { |
| 999 visitVariable(node.variable); | 1005 visitVariable(node.variable); |
| 1000 } | 1006 } |
| 1001 | 1007 |
| 1008 visitVariableDeclaration(VariableDeclaration node) { |
| 1009 visitVariable(node.variable); |
| 1010 visitStatement(node.next); |
| 1011 } |
| 1012 |
| 1013 visitAssign(Assign node) { |
| 1014 visitVariable(node.variable); |
| 1015 visitExpression(node.value); |
| 1016 } |
| 1017 |
| 1002 visitInvokeStatic(InvokeStatic node) { | 1018 visitInvokeStatic(InvokeStatic node) { |
| 1003 node.arguments.forEach(visitExpression); | 1019 node.arguments.forEach(visitExpression); |
| 1004 } | 1020 } |
| 1005 | 1021 |
| 1006 visitInvokeMethod(InvokeMethod node) { | 1022 visitInvokeMethod(InvokeMethod node) { |
| 1007 visitExpression(node.receiver); | 1023 visitExpression(node.receiver); |
| 1008 node.arguments.forEach(visitExpression); | 1024 node.arguments.forEach(visitExpression); |
| 1009 } | 1025 } |
| 1010 | 1026 |
| 1011 visitInvokeMethodDirectly(InvokeMethodDirectly node) { | 1027 visitInvokeMethodDirectly(InvokeMethodDirectly node) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 | 1075 |
| 1060 visitFunctionExpression(FunctionExpression node) { | 1076 visitFunctionExpression(FunctionExpression node) { |
| 1061 visitInnerFunction(node.definition); | 1077 visitInnerFunction(node.definition); |
| 1062 } | 1078 } |
| 1063 | 1079 |
| 1064 visitLabeledStatement(LabeledStatement node) { | 1080 visitLabeledStatement(LabeledStatement node) { |
| 1065 visitStatement(node.body); | 1081 visitStatement(node.body); |
| 1066 visitStatement(node.next); | 1082 visitStatement(node.next); |
| 1067 } | 1083 } |
| 1068 | 1084 |
| 1069 visitAssign(Assign node) { | |
| 1070 visitExpression(node.value); | |
| 1071 visitVariable(node.variable); | |
| 1072 visitStatement(node.next); | |
| 1073 } | |
| 1074 | |
| 1075 visitReturn(Return node) { | 1085 visitReturn(Return node) { |
| 1076 visitExpression(node.value); | 1086 visitExpression(node.value); |
| 1077 } | 1087 } |
| 1078 | 1088 |
| 1079 visitBreak(Break node) {} | 1089 visitBreak(Break node) {} |
| 1080 | 1090 |
| 1081 visitContinue(Continue node) {} | 1091 visitContinue(Continue node) {} |
| 1082 | 1092 |
| 1083 visitIf(If node) { | 1093 visitIf(If node) { |
| 1084 visitExpression(node.condition); | 1094 visitExpression(node.condition); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1111 visitStatement(node.catchBody); | 1121 visitStatement(node.catchBody); |
| 1112 } | 1122 } |
| 1113 | 1123 |
| 1114 visitGetField(GetField node) { | 1124 visitGetField(GetField node) { |
| 1115 visitExpression(node.object); | 1125 visitExpression(node.object); |
| 1116 } | 1126 } |
| 1117 | 1127 |
| 1118 visitSetField(SetField node) { | 1128 visitSetField(SetField node) { |
| 1119 visitExpression(node.object); | 1129 visitExpression(node.object); |
| 1120 visitExpression(node.value); | 1130 visitExpression(node.value); |
| 1121 visitStatement(node.next); | |
| 1122 } | 1131 } |
| 1123 | 1132 |
| 1124 visitCreateBox(CreateBox node) { | 1133 visitCreateBox(CreateBox node) { |
| 1125 } | 1134 } |
| 1126 | 1135 |
| 1127 visitCreateInstance(CreateInstance node) { | 1136 visitCreateInstance(CreateInstance node) { |
| 1128 node.arguments.forEach(visitExpression); | 1137 node.arguments.forEach(visitExpression); |
| 1129 node.typeInformation.forEach(visitExpression); | 1138 node.typeInformation.forEach(visitExpression); |
| 1130 } | 1139 } |
| 1131 | 1140 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1154 } | 1163 } |
| 1155 | 1164 |
| 1156 void _replaceExpressions(List<Expression> list) { | 1165 void _replaceExpressions(List<Expression> list) { |
| 1157 for (int i = 0; i < list.length; i++) { | 1166 for (int i = 0; i < list.length; i++) { |
| 1158 list[i] = visitExpression(list[i]); | 1167 list[i] = visitExpression(list[i]); |
| 1159 } | 1168 } |
| 1160 } | 1169 } |
| 1161 | 1170 |
| 1162 visitVariableUse(VariableUse node) => node; | 1171 visitVariableUse(VariableUse node) => node; |
| 1163 | 1172 |
| 1173 visitVariableDeclaration(VariableDeclaration node) { |
| 1174 node.next = visitStatement(node.next); |
| 1175 return node; |
| 1176 } |
| 1177 |
| 1178 visitAssign(Assign node) { |
| 1179 node.value = visitExpression(node.value); |
| 1180 return node; |
| 1181 } |
| 1182 |
| 1164 visitInvokeStatic(InvokeStatic node) { | 1183 visitInvokeStatic(InvokeStatic node) { |
| 1165 _replaceExpressions(node.arguments); | 1184 _replaceExpressions(node.arguments); |
| 1166 return node; | 1185 return node; |
| 1167 } | 1186 } |
| 1168 | 1187 |
| 1169 visitInvokeMethod(InvokeMethod node) { | 1188 visitInvokeMethod(InvokeMethod node) { |
| 1170 node.receiver = visitExpression(node.receiver); | 1189 node.receiver = visitExpression(node.receiver); |
| 1171 _replaceExpressions(node.arguments); | 1190 _replaceExpressions(node.arguments); |
| 1172 return node; | 1191 return node; |
| 1173 } | 1192 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 visitInnerFunction(node.definition); | 1253 visitInnerFunction(node.definition); |
| 1235 return node; | 1254 return node; |
| 1236 } | 1255 } |
| 1237 | 1256 |
| 1238 visitLabeledStatement(LabeledStatement node) { | 1257 visitLabeledStatement(LabeledStatement node) { |
| 1239 node.body = visitStatement(node.body); | 1258 node.body = visitStatement(node.body); |
| 1240 node.next = visitStatement(node.next); | 1259 node.next = visitStatement(node.next); |
| 1241 return node; | 1260 return node; |
| 1242 } | 1261 } |
| 1243 | 1262 |
| 1244 visitAssign(Assign node) { | |
| 1245 node.value = visitExpression(node.value); | |
| 1246 node.next = visitStatement(node.next); | |
| 1247 return node; | |
| 1248 } | |
| 1249 | |
| 1250 visitReturn(Return node) { | 1263 visitReturn(Return node) { |
| 1251 node.value = visitExpression(node.value); | 1264 node.value = visitExpression(node.value); |
| 1252 return node; | 1265 return node; |
| 1253 } | 1266 } |
| 1254 | 1267 |
| 1255 visitBreak(Break node) => node; | 1268 visitBreak(Break node) => node; |
| 1256 | 1269 |
| 1257 visitContinue(Continue node) => node; | 1270 visitContinue(Continue node) => node; |
| 1258 | 1271 |
| 1259 visitIf(If node) { | 1272 visitIf(If node) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 } | 1307 } |
| 1295 | 1308 |
| 1296 visitGetField(GetField node) { | 1309 visitGetField(GetField node) { |
| 1297 node.object = visitExpression(node.object); | 1310 node.object = visitExpression(node.object); |
| 1298 return node; | 1311 return node; |
| 1299 } | 1312 } |
| 1300 | 1313 |
| 1301 visitSetField(SetField node) { | 1314 visitSetField(SetField node) { |
| 1302 node.object = visitExpression(node.object); | 1315 node.object = visitExpression(node.object); |
| 1303 node.value = visitExpression(node.value); | 1316 node.value = visitExpression(node.value); |
| 1304 node.next = visitStatement(node.next); | |
| 1305 return node; | 1317 return node; |
| 1306 } | 1318 } |
| 1307 | 1319 |
| 1308 visitCreateBox(CreateBox node) => node; | 1320 visitCreateBox(CreateBox node) => node; |
| 1309 | 1321 |
| 1310 visitCreateInstance(CreateInstance node) { | 1322 visitCreateInstance(CreateInstance node) { |
| 1311 _replaceExpressions(node.arguments); | 1323 _replaceExpressions(node.arguments); |
| 1312 return node; | 1324 return node; |
| 1313 } | 1325 } |
| 1314 | 1326 |
| 1315 visitReifyRuntimeType(ReifyRuntimeType node) { | 1327 visitReifyRuntimeType(ReifyRuntimeType node) { |
| 1316 node.value = visitExpression(node.value); | 1328 node.value = visitExpression(node.value); |
| 1317 return node; | 1329 return node; |
| 1318 } | 1330 } |
| 1319 | 1331 |
| 1320 visitReadTypeVariable(ReadTypeVariable node) { | 1332 visitReadTypeVariable(ReadTypeVariable node) { |
| 1321 node.target = visitExpression(node.target); | 1333 node.target = visitExpression(node.target); |
| 1322 return node; | 1334 return node; |
| 1323 } | 1335 } |
| 1324 | 1336 |
| 1325 visitTypeExpression(TypeExpression node) { | 1337 visitTypeExpression(TypeExpression node) { |
| 1326 _replaceExpressions(node.arguments); | 1338 _replaceExpressions(node.arguments); |
| 1327 return node; | 1339 return node; |
| 1328 } | 1340 } |
| 1329 } | 1341 } |
| OLD | NEW |