Index: pkg/compiler/lib/src/js_backend/codegen/codegen.dart |
diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart |
index 8bb26fd773bd3439b8db3e8c9a99466e54209db6..9efbc4b6eb1953beeda5332784bfbbd5c2cde02d 100644 |
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart |
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart |
@@ -945,6 +945,24 @@ class CodeGenerator extends tree_ir.StatementVisitor |
} |
@override |
+ void visitNullCheck(tree_ir.NullCheck node) { |
+ js.Expression value = visitExpression(node.value); |
+ js.Expression access = node.selector != null |
+ ? js.js('#.#', [value, glue.invocationName(node.selector)]) |
+ : js.js('#.toString', [value]); |
+ if (node.condition != null) { |
+ js.Expression condition = visitExpression(node.condition); |
+ js.Statement body = isNullReturn(node.next) |
+ ? new js.ExpressionStatement(access) |
+ : new js.Return(access); |
+ accumulator.add(new js.If.noElse(condition, body)); |
+ } else { |
+ accumulator.add(new js.ExpressionStatement(access)); |
+ } |
+ visitStatement(node.next); |
+ } |
+ |
+ @override |
js.Expression visitApplyBuiltinOperator(tree_ir.ApplyBuiltinOperator node) { |
List<js.Expression> args = visitExpressionList(node.arguments); |
switch (node.operator) { |