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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
index d200e405e5cf36eef3aa733695a69536760dfbdf..2231d47d09705721d0006e6e73d88358f50d1c25 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
@@ -192,14 +192,17 @@ class InvokeStatic extends Expression implements Invoke {
/**
* A call to a method, operator, getter, setter or index getter/setter.
*
- * In contrast to the CPS-based IR, the receiver and arguments can be
- * arbitrary expressions.
+ * If [receiver] is `null`, an error is thrown before the arguments are
+ * evaluated. This corresponds to the JS evaluation order.
*/
class InvokeMethod extends Expression implements Invoke {
Expression receiver;
final Selector selector;
final List<Expression> arguments;
+ /// If true, it is known that the receiver cannot be `null`.
+ bool receiverIsNotNull = false;
+
InvokeMethod(this.receiver, this.selector, this.arguments) {
assert(receiver != null);
}
@@ -211,6 +214,9 @@ class InvokeMethod extends Expression implements Invoke {
}
/// Invoke [target] on [receiver], bypassing ordinary dispatch semantics.
+///
+/// Since the [receiver] is not used for method lookup, it may be `null`
+/// without an error being thrown.
class InvokeMethodDirectly extends Expression implements Invoke {
Expression receiver;
final Element target;

Powered by Google App Engine
This is Rietveld 408576698