Index: pkg/compiler/lib/src/ssa/builder.dart |
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart |
index 40e291d2cce465bcba536335cd827a5c942d264b..bf19f704d2f38d7464a25d478aef4f0fc640f61a 100644 |
--- a/pkg/compiler/lib/src/ssa/builder.dart |
+++ b/pkg/compiler/lib/src/ssa/builder.dart |
@@ -2608,37 +2608,6 @@ class SsaBuilder extends ast.Visitor |
return pop(); |
} |
- visitAssert(ast.Assert node) { |
- if (!compiler.enableUserAssertions) return; |
- |
- if (!node.hasMessage) { |
- // Generate: |
- // |
- // assertHelper(condition); |
- // |
- visit(node.condition); |
- pushInvokeStatic(node, backend.assertHelperMethod, [pop()]); |
- pop(); |
- return; |
- } |
- // Assert has message. Generate: |
- // |
- // if (assertTest(condition)) assertThrow(message); |
- // |
- void buildCondition() { |
- visit(node.condition); |
- pushInvokeStatic(node, backend.assertTestMethod, [pop()]); |
- } |
- void fail() { |
- visit(node.message); |
- pushInvokeStatic(node, backend.assertThrowMethod, [pop()]); |
- pop(); |
- } |
- handleIf(node, |
- visitCondition: buildCondition, |
- visitThen: fail); |
- } |
- |
visitBlock(ast.Block node) { |
assert(!isAborted()); |
if (!isReachable) return; // This can only happen when inlining. |
@@ -5214,6 +5183,18 @@ class SsaBuilder extends ast.Visitor |
return false; |
} |
+ @override |
+ visitAssert(ast.Send node, ast.Node expression, _) { |
+ if (!compiler.enableUserAssertions) { |
+ stack.add(graph.addConstantNull(compiler)); |
+ return; |
+ } |
+ assert(invariant(node, node.arguments.tail.isEmpty, |
+ message: "Invalid assertion: $node")); |
+ generateStaticFunctionInvoke( |
+ node, backend.assertMethod, CallStructure.ONE_ARG); |
+ } |
+ |
visitStaticSend(ast.Send node) { |
internalError(node, "Unexpected visitStaticSend"); |
} |
@@ -8330,6 +8311,14 @@ class SsaBuilder extends ast.Visitor |
} |
@override |
+ void errorInvalidAssert( |
+ ast.Send node, |
+ ast.NodeList arguments, |
+ _) { |
+ visitNode(node); |
+ } |
+ |
+ @override |
void errorUndefinedBinaryExpression( |
ast.Send node, |
ast.Node left, |