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

Unified Diff: pkg/compiler/lib/src/tree_ir/tree_ir_nodes.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
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 80e4f28894e6db0c288a52fa9f7b3e46443a21f4..6cd53ec0796b00f0330b53b464dbde6749c76b60 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
@@ -957,6 +957,25 @@ class Yield extends Statement {
}
}
+class NullCheck extends Statement {
+ Expression condition;
+ Expression value;
+ Selector selector;
+ Statement next;
+ SourceInformation sourceInformation;
+
+ NullCheck({this.condition, this.value, this.selector, this.next,
+ this.sourceInformation});
+
+ accept(StatementVisitor visitor) {
+ return visitor.visitNullCheck(this);
+ }
+
+ accept1(StatementVisitor1 visitor, arg) {
+ return visitor.visitNullCheck(this, arg);
+ }
+}
+
abstract class ExpressionVisitor<E> {
E visitExpression(Expression node) => node.accept(this);
E visitVariableUse(VariableUse node);
@@ -1047,6 +1066,7 @@ abstract class StatementVisitor<S> {
S visitUnreachable(Unreachable node);
S visitForeignStatement(ForeignStatement node);
S visitYield(Yield node);
+ S visitNullCheck(NullCheck node);
}
abstract class StatementVisitor1<S, A> {
@@ -1065,6 +1085,7 @@ abstract class StatementVisitor1<S, A> {
S visitUnreachable(Unreachable node, A arg);
S visitForeignStatement(ForeignStatement node, A arg);
S visitYield(Yield node, A arg);
+ S visitNullCheck(NullCheck node, A arg);
}
abstract class RecursiveVisitor implements StatementVisitor, ExpressionVisitor {
@@ -1277,6 +1298,12 @@ abstract class RecursiveVisitor implements StatementVisitor, ExpressionVisitor {
visitExpression(node.input);
visitStatement(node.next);
}
+
+ visitNullCheck(NullCheck node) {
+ if (node.condition != null) visitExpression(node.condition);
+ visitExpression(node.value);
+ visitStatement(node.next);
+ }
}
abstract class Transformer implements ExpressionVisitor<Expression>,
@@ -1534,6 +1561,15 @@ class RecursiveTransformer extends Transformer {
node.next = visitStatement(node.next);
return node;
}
+
+ visitNullCheck(NullCheck node) {
+ if (node.condition != null) {
+ node.condition = visitExpression(node.condition);
+ }
+ node.value = visitExpression(node.value);
+ node.next = visitStatement(node.next);
+ return node;
+ }
}
class FallthroughTarget {
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698