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

Unified Diff: pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.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/optimization/statement_rewriter.dart
diff --git a/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart b/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart
index 1f5fea0e4ab43f379a60c2e3fe484ec279471075..691e206adfad569c27630d3e1cb4b29f5f85bf1f 100644
--- a/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart
+++ b/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart
@@ -347,8 +347,17 @@ class StatementRewriter extends Transformer implements Pass {
}
Expression visitInvokeMethod(InvokeMethod node) {
- _rewriteList(node.arguments);
- node.receiver = visitExpression(node.receiver);
+ if (node.receiverIsNotNull) {
+ _rewriteList(node.arguments);
+ node.receiver = visitExpression(node.receiver);
+ } else {
+ // Impure expressions cannot be propagated across the method lookup,
+ // because it throws when the receiver is null.
+ inEmptyEnvironment(() {
+ _rewriteList(node.arguments);
+ });
+ node.receiver = visitExpression(node.receiver);
+ }
return node;
}

Powered by Google App Engine
This is Rietveld 408576698