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

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

Issue 1159643005: dart2js cps: Do not propagate impure expressions across null receiver. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Extra fix in type propagation Created 5 years, 6 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
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/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, InterfaceType, TypeVariableType; 9 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType;
10 import '../elements/elements.dart'; 10 import '../elements/elements.dart';
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 accept(ExpressionVisitor visitor) => visitor.visitInvokeStatic(this); 186 accept(ExpressionVisitor visitor) => visitor.visitInvokeStatic(this);
187 accept1(ExpressionVisitor1 visitor, arg) { 187 accept1(ExpressionVisitor1 visitor, arg) {
188 return visitor.visitInvokeStatic(this, arg); 188 return visitor.visitInvokeStatic(this, arg);
189 } 189 }
190 } 190 }
191 191
192 /** 192 /**
193 * A call to a method, operator, getter, setter or index getter/setter. 193 * A call to a method, operator, getter, setter or index getter/setter.
194 * 194 *
195 * In contrast to the CPS-based IR, the receiver and arguments can be 195 * If [receiver] is `null`, an error is thrown before the arguments are
196 * arbitrary expressions. 196 * evaluated. This corresponds to the JS evaluation order.
197 */ 197 */
198 class InvokeMethod extends Expression implements Invoke { 198 class InvokeMethod extends Expression implements Invoke {
199 Expression receiver; 199 Expression receiver;
200 final Selector selector; 200 final Selector selector;
201 final List<Expression> arguments; 201 final List<Expression> arguments;
202 202
203 /// If true, it is known that the receiver cannot be `null`.
204 bool receiverIsNotNull = false;
205
203 InvokeMethod(this.receiver, this.selector, this.arguments) { 206 InvokeMethod(this.receiver, this.selector, this.arguments) {
204 assert(receiver != null); 207 assert(receiver != null);
205 } 208 }
206 209
207 accept(ExpressionVisitor visitor) => visitor.visitInvokeMethod(this); 210 accept(ExpressionVisitor visitor) => visitor.visitInvokeMethod(this);
208 accept1(ExpressionVisitor1 visitor, arg) { 211 accept1(ExpressionVisitor1 visitor, arg) {
209 return visitor.visitInvokeMethod(this, arg); 212 return visitor.visitInvokeMethod(this, arg);
210 } 213 }
211 } 214 }
212 215
213 /// Invoke [target] on [receiver], bypassing ordinary dispatch semantics. 216 /// Invoke [target] on [receiver], bypassing ordinary dispatch semantics.
217 ///
218 /// Since the [receiver] is not used for method lookup, it may be `null`
219 /// without an error being thrown.
214 class InvokeMethodDirectly extends Expression implements Invoke { 220 class InvokeMethodDirectly extends Expression implements Invoke {
215 Expression receiver; 221 Expression receiver;
216 final Element target; 222 final Element target;
217 final Selector selector; 223 final Selector selector;
218 final List<Expression> arguments; 224 final List<Expression> arguments;
219 225
220 InvokeMethodDirectly(this.receiver, this.target, this.selector, 226 InvokeMethodDirectly(this.receiver, this.target, this.selector,
221 this.arguments); 227 this.arguments);
222 228
223 accept(ExpressionVisitor visitor) => visitor.visitInvokeMethodDirectly(this); 229 accept(ExpressionVisitor visitor) => visitor.visitInvokeMethodDirectly(this);
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 visitTypeExpression(TypeExpression node) { 1197 visitTypeExpression(TypeExpression node) {
1192 _replaceExpressions(node.arguments); 1198 _replaceExpressions(node.arguments);
1193 return node; 1199 return node;
1194 } 1200 }
1195 1201
1196 visitCreateInvocationMirror(CreateInvocationMirror node) { 1202 visitCreateInvocationMirror(CreateInvocationMirror node) {
1197 _replaceExpressions(node.arguments); 1203 _replaceExpressions(node.arguments);
1198 return node; 1204 return node;
1199 } 1205 }
1200 } 1206 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698