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

Unified Diff: pkg/compiler/lib/src/parser/parser.dart

Issue 1325843003: Add optional message to assert in Dart2js. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Reintroduce assertHelper for asserts without messages. 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
Index: pkg/compiler/lib/src/parser/parser.dart
diff --git a/pkg/compiler/lib/src/parser/parser.dart b/pkg/compiler/lib/src/parser/parser.dart
index 68f96bc363c60187aa22cd6313edd5fb5918061f..6ed2657b74a53e158e607f8e2b38a95ab8db671c 100644
--- a/pkg/compiler/lib/src/parser/parser.dart
+++ b/pkg/compiler/lib/src/parser/parser.dart
@@ -2697,10 +2697,20 @@ class Parser {
Token parseAssertStatement(Token token) {
Token assertKeyword = token;
+ Token commaToken = null;
token = expect('assert', token);
- expect('(', token);
- token = parseArguments(token);
- listener.handleAssertStatement(assertKeyword, token);
+ token = expect('(', token);
+ bool old = mayParseFunctionExpressions;
+ mayParseFunctionExpressions = true;
+ token = parseExpression(token);
+ if (optional(',', token)) {
+ commaToken = token;
+ token = token.next;
+ token = parseExpression(token);
+ }
+ token = expect(')', token);
+ mayParseFunctionExpressions = old;
+ listener.handleAssertStatement(assertKeyword, commaToken, token);
return expectSemicolon(token);
}

Powered by Google App Engine
This is Rietveld 408576698