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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.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/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_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/cps_ir/cps_ir_nodes_sexpr.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
index 12262e13491f56cc66518585fcd9e5ed1ff3a428..dc2768f75ba1c5b833c2c7d20a04237f3b7a6912 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart
@@ -33,6 +33,10 @@ class SExpressionStringifier extends Indentation implements Visitor<String> {
return decorator(r, namer.getName(r.definition));
}
+ String optional(Reference<Definition> r) {
+ return r == null ? '()' : '(${access(r)})';
+ }
+
String visitParameter(Parameter node) {
return namer.nameParameter(node);
}
@@ -360,6 +364,12 @@ class SExpressionStringifier extends Indentation implements Visitor<String> {
String value = access(node.value);
return '(Refinement $value ${node.type})';
}
+
+ String visitNullCheck(NullCheck node) {
+ String value = access(node.value);
+ String condition = optional(node.condition);
+ return '(NullCheck $value $condition (${node.selector ?? ""}))';
+ }
}
class ConstantStringifier extends ConstantValueVisitor<String, Null> {
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698