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

Unified Diff: pkg/compiler/lib/src/parser/node_listener.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/node_listener.dart
diff --git a/pkg/compiler/lib/src/parser/node_listener.dart b/pkg/compiler/lib/src/parser/node_listener.dart
index 455f53e2282f45682a9b35a420f8c927b9820ed9..d8383f3f9e09addf71c2fba168b7d7159907886e 100644
--- a/pkg/compiler/lib/src/parser/node_listener.dart
+++ b/pkg/compiler/lib/src/parser/node_listener.dart
@@ -763,11 +763,16 @@ class NodeListener extends ElementListener {
}
}
- void handleAssertStatement(Token assertKeyword, Token semicolonToken) {
- NodeList arguments = popNode();
- Node selector = new Identifier(assertKeyword);
- Node send = new Send(null, selector, arguments);
- pushNode(new ExpressionStatement(send, semicolonToken));
+ void handleAssertStatement(Token assertKeyword,
+ Token commaToken, Token semicolonToken) {
+ Node message;
+ Node condition;
+ if (commaToken != null) {
+ message = popNode();
+ }
+ condition = popNode();
+ pushNode(new Assert(assertKeyword, condition,
+ message, semicolonToken));
}
void endUnnamedFunction(Token token) {

Powered by Google App Engine
This is Rietveld 408576698