Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Side by Side Diff: pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart

Issue 1785633002: Make source information mandatory for building send-like node in CPS (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/values.dart' as values; 7 import '../constants/values.dart' as values;
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 static int _usedHashCodes = 0; 49 static int _usedHashCodes = 0;
50 final int hashCode = ++_usedHashCodes; 50 final int hashCode = ++_usedHashCodes;
51 } 51 }
52 52
53 /** 53 /**
54 * The base class of [Expression]s. 54 * The base class of [Expression]s.
55 */ 55 */
56 abstract class Expression extends Node { 56 abstract class Expression extends Node {
57 accept(ExpressionVisitor v); 57 accept(ExpressionVisitor v);
58 accept1(ExpressionVisitor1 v, arg); 58 accept1(ExpressionVisitor1 v, arg);
59
60 SourceInformation get sourceInformation => null;
59 } 61 }
60 62
61 abstract class Statement extends Node { 63 abstract class Statement extends Node {
62 Statement get next; 64 Statement get next;
63 void set next(Statement s); 65 void set next(Statement s);
64 accept(StatementVisitor v); 66 accept(StatementVisitor v);
65 accept1(StatementVisitor1 v, arg); 67 accept1(StatementVisitor1 v, arg);
66 } 68 }
67 69
68 /** 70 /**
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 assert(host != null); 118 assert(host != null);
117 } 119 }
118 120
119 String toString() => 121 String toString() =>
120 element == null ? 'Variable.${hashCode}' : element.toString(); 122 element == null ? 'Variable.${hashCode}' : element.toString();
121 } 123 }
122 124
123 /// Read the value of a variable. 125 /// Read the value of a variable.
124 class VariableUse extends Expression { 126 class VariableUse extends Expression {
125 Variable variable; 127 Variable variable;
128 SourceInformation sourceInformation;
126 129
127 /// Creates a use of [variable] and updates its `readCount`. 130 /// Creates a use of [variable] and updates its `readCount`.
128 VariableUse(this.variable) { 131 VariableUse(this.variable, {this.sourceInformation}) {
129 variable.readCount++; 132 variable.readCount++;
130 } 133 }
131 134
132 accept(ExpressionVisitor visitor) => visitor.visitVariableUse(this); 135 accept(ExpressionVisitor visitor) => visitor.visitVariableUse(this);
133 accept1(ExpressionVisitor1 visitor, arg) { 136 accept1(ExpressionVisitor1 visitor, arg) {
134 return visitor.visitVariableUse(this, arg); 137 return visitor.visitVariableUse(this, arg);
135 } 138 }
136 } 139 }
137 140
138 class Assign extends Expression { 141 class Assign extends Expression {
139 Variable variable; 142 Variable variable;
140 Expression value; 143 Expression value;
144 SourceInformation sourceInformation;
141 145
142 Assign(this.variable, this.value) { 146 Assign(this.variable, this.value, {this.sourceInformation}) {
143 variable.writeCount++; 147 variable.writeCount++;
144 } 148 }
145 149
146 accept(ExpressionVisitor v) => v.visitAssign(this); 150 accept(ExpressionVisitor v) => v.visitAssign(this);
147 accept1(ExpressionVisitor1 v, arg) => v.visitAssign(this, arg); 151 accept1(ExpressionVisitor1 v, arg) => v.visitAssign(this, arg);
148 152
149 static ExpressionStatement makeStatement(Variable variable, 153 static ExpressionStatement makeStatement(Variable variable,
150 Expression value, 154 Expression value,
151 [Statement next]) { 155 [Statement next]) {
152 return new ExpressionStatement(new Assign(variable, value), next); 156 return new ExpressionStatement(new Assign(variable, value), next);
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 accept(ExpressionVisitor visitor) => visitor.visitCreateInstance(this); 690 accept(ExpressionVisitor visitor) => visitor.visitCreateInstance(this);
687 accept1(ExpressionVisitor1 visitor, arg) { 691 accept1(ExpressionVisitor1 visitor, arg) {
688 return visitor.visitCreateInstance(this, arg); 692 return visitor.visitCreateInstance(this, arg);
689 } 693 }
690 } 694 }
691 695
692 class GetField extends Expression { 696 class GetField extends Expression {
693 Expression object; 697 Expression object;
694 Element field; 698 Element field;
695 bool objectIsNotNull; 699 bool objectIsNotNull;
700 SourceInformation sourceInformation;
696 701
697 GetField(this.object, this.field, {this.objectIsNotNull: false}); 702 GetField(
703 this.object,
704 this.field,
705 this.sourceInformation,
706 {this.objectIsNotNull: false});
698 707
699 accept(ExpressionVisitor visitor) => visitor.visitGetField(this); 708 accept(ExpressionVisitor visitor) => visitor.visitGetField(this);
700 accept1(ExpressionVisitor1 visitor, arg) => visitor.visitGetField(this, arg); 709 accept1(ExpressionVisitor1 visitor, arg) => visitor.visitGetField(this, arg);
701 } 710 }
702 711
703 class SetField extends Expression { 712 class SetField extends Expression {
704 Expression object; 713 Expression object;
705 Element field; 714 Element field;
706 Expression value; 715 Expression value;
716 SourceInformation sourceInformation;
707 717
708 /// If non-null, this is a compound assignment to the field, using the given 718 /// If non-null, this is a compound assignment to the field, using the given
709 /// operator. The operator must be a compoundable operator. 719 /// operator. The operator must be a compoundable operator.
710 BuiltinOperator compound; 720 BuiltinOperator compound;
711 721
712 SetField(this.object, this.field, this.value, {this.compound}); 722 SetField(
723 this.object,
724 this.field,
725 this.value,
726 this.sourceInformation,
727 {this.compound});
713 728
714 accept(ExpressionVisitor visitor) => visitor.visitSetField(this); 729 accept(ExpressionVisitor visitor) => visitor.visitSetField(this);
715 accept1(ExpressionVisitor1 visitor, arg) => visitor.visitSetField(this, arg); 730 accept1(ExpressionVisitor1 visitor, arg) => visitor.visitSetField(this, arg);
716 } 731 }
717 732
718 733
719 /// Read the type test property from [object]. The value is truthy/fasly rather 734 /// Read the type test property from [object]. The value is truthy/fasly rather
720 /// than bool. [object] must not be `null`. 735 /// than bool. [object] must not be `null`.
721 class GetTypeTestProperty extends Expression { 736 class GetTypeTestProperty extends Expression {
722 Expression object; 737 Expression object;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 } 865 }
851 } 866 }
852 867
853 class ForeignCode extends Node { 868 class ForeignCode extends Node {
854 final js.Template codeTemplate; 869 final js.Template codeTemplate;
855 final types.TypeMask type; 870 final types.TypeMask type;
856 final List<Expression> arguments; 871 final List<Expression> arguments;
857 final native.NativeBehavior nativeBehavior; 872 final native.NativeBehavior nativeBehavior;
858 final List<bool> nullableArguments; // One 'bit' per argument. 873 final List<bool> nullableArguments; // One 'bit' per argument.
859 final Element dependency; 874 final Element dependency;
875 final SourceInformation sourceInformation;
860 876
861 ForeignCode(this.codeTemplate, this.type, this.arguments, this.nativeBehavior, 877 ForeignCode(
862 this.nullableArguments, this.dependency) { 878 this.codeTemplate,
879 this.type,
880 this.arguments,
881 this.nativeBehavior,
882 this.nullableArguments,
883 this.dependency,
884 this.sourceInformation) {
863 assert(arguments.length == nullableArguments.length); 885 assert(arguments.length == nullableArguments.length);
864 } 886 }
865 } 887 }
866 888
867 class ForeignExpression extends ForeignCode implements Expression { 889 class ForeignExpression extends ForeignCode implements Expression {
868 ForeignExpression( 890 ForeignExpression(
869 js.Template codeTemplate, types.TypeMask type, 891 js.Template codeTemplate, types.TypeMask type,
870 List<Expression> arguments, native.NativeBehavior nativeBehavior, 892 List<Expression> arguments, native.NativeBehavior nativeBehavior,
871 List<bool> nullableArguments, 893 List<bool> nullableArguments,
872 Element dependency) 894 Element dependency,
895 SourceInformation sourceInformation)
873 : super(codeTemplate, type, arguments, nativeBehavior, nullableArguments, 896 : super(codeTemplate, type, arguments, nativeBehavior, nullableArguments,
874 dependency); 897 dependency, sourceInformation);
875 898
876 accept(ExpressionVisitor visitor) { 899 accept(ExpressionVisitor visitor) {
877 return visitor.visitForeignExpression(this); 900 return visitor.visitForeignExpression(this);
878 } 901 }
879 902
880 accept1(ExpressionVisitor1 visitor, arg) { 903 accept1(ExpressionVisitor1 visitor, arg) {
881 return visitor.visitForeignExpression(this, arg); 904 return visitor.visitForeignExpression(this, arg);
882 } 905 }
883 } 906 }
884 907
885 class ForeignStatement extends ForeignCode implements Statement { 908 class ForeignStatement extends ForeignCode implements Statement {
886 ForeignStatement( 909 ForeignStatement(
887 js.Template codeTemplate, types.TypeMask type, 910 js.Template codeTemplate, types.TypeMask type,
888 List<Expression> arguments, native.NativeBehavior nativeBehavior, 911 List<Expression> arguments, native.NativeBehavior nativeBehavior,
889 List<bool> nullableArguments, 912 List<bool> nullableArguments,
890 Element dependency) 913 Element dependency,
914 SourceInformation sourceInformation)
891 : super(codeTemplate, type, arguments, nativeBehavior, nullableArguments, 915 : super(codeTemplate, type, arguments, nativeBehavior, nullableArguments,
892 dependency); 916 dependency, sourceInformation);
893 917
894 accept(StatementVisitor visitor) { 918 accept(StatementVisitor visitor) {
895 return visitor.visitForeignStatement(this); 919 return visitor.visitForeignStatement(this);
896 } 920 }
897 921
898 accept1(StatementVisitor1 visitor, arg) { 922 accept1(StatementVisitor1 visitor, arg) {
899 return visitor.visitForeignStatement(this, arg); 923 return visitor.visitForeignStatement(this, arg);
900 } 924 }
901 925
902 @override 926 @override
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 1614
1591 /// Number of uses of the current fallthrough target. 1615 /// Number of uses of the current fallthrough target.
1592 int get useCount => _stack.last.useCount; 1616 int get useCount => _stack.last.useCount;
1593 1617
1594 /// Indicate that a statement will fall through to the current fallthrough 1618 /// Indicate that a statement will fall through to the current fallthrough
1595 /// target. 1619 /// target.
1596 void use() { 1620 void use() {
1597 ++_stack.last.useCount; 1621 ++_stack.last.useCount;
1598 } 1622 }
1599 } 1623 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698