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

Unified Diff: pkg/compiler/lib/src/tree_ir/optimization/pull_into_initializers.dart

Issue 1507313006: dart2js cps: Add instruction for null checks. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix true/false misdocumentation about condition and do not emit call Created 5 years 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/pull_into_initializers.dart
diff --git a/pkg/compiler/lib/src/tree_ir/optimization/pull_into_initializers.dart b/pkg/compiler/lib/src/tree_ir/optimization/pull_into_initializers.dart
index 18bab391400d4d79f1b58ba5c603614e0932ff41..27305149f664ee4d896eb843da59b602e064f0fa 100644
--- a/pkg/compiler/lib/src/tree_ir/optimization/pull_into_initializers.dart
+++ b/pkg/compiler/lib/src/tree_ir/optimization/pull_into_initializers.dart
@@ -168,6 +168,16 @@ class PullIntoInitializers extends RecursiveTransformer
return node;
}
+ Statement visitNullCheck(NullCheck node) {
+ if (node.condition != null) {
+ node.condition = visitExpression(node.condition);
+ // The value occurs in conditional context, so don't pull from that.
+ } else {
+ node.value = visitExpression(node.value);
+ }
+ return node;
+ }
+
Expression visitAssign(Assign node) {
bool inImpureContext = impureCounter > 0;
bool inBranch = branchCounter > 0;

Powered by Google App Engine
This is Rietveld 408576698