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

Unified Diff: pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.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/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 ecdbccb2c6ff886921d45bbef35aea7f4b59ab60..63d5f86ad2f1e3ab65decdc65f359bf6a657aff9 100644
--- a/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart
+++ b/pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart
@@ -1185,6 +1185,23 @@ class StatementRewriter extends Transformer implements Pass {
node.next = visitStatement(node.next);
return node;
}
+
+ @override
+ Statement visitNullCheck(NullCheck node) {
+ inEmptyEnvironment(() {
+ node.next = visitStatement(node.next);
+ });
+ if (node.condition != null) {
+ inEmptyEnvironment(() {
+ // Value occurs in conditional context.
+ node.value = visitExpression(node.value);
+ });
+ node.condition = visitExpression(node.condition);
+ } else {
+ node.value = visitExpression(node.value);
+ }
+ return node;
+ }
}
/// Result of combining two expressions, with the potential for reverting the

Powered by Google App Engine
This is Rietveld 408576698