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

Unified Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 1346093003: Revert "Add optional message to assert in Dart2js - continued" (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months 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/resolution/tree_elements.dart ('k') | pkg/compiler/lib/src/tree/nodes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « pkg/compiler/lib/src/resolution/tree_elements.dart ('k') | pkg/compiler/lib/src/tree/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698