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

Unified Diff: tests/compiler/dart2js/backend_dart/dart_printer_test.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: tests/compiler/dart2js/backend_dart/dart_printer_test.dart
diff --git a/tests/compiler/dart2js/backend_dart/dart_printer_test.dart b/tests/compiler/dart2js/backend_dart/dart_printer_test.dart
index 801b75d1063d1f11d77c7ec2a556ec01cb067548..f6fd38bea1bf4c881d072e54887f4b89b43e688b 100644
--- a/tests/compiler/dart2js/backend_dart/dart_printer_test.dart
+++ b/tests/compiler/dart2js/backend_dart/dart_printer_test.dart
@@ -587,9 +587,14 @@ class AstBuilder extends Listener {
push(new ForIn(declaredIdentifier, exp, body));
}
- handleAssertStatement(Token assertKeyword, Token semicolonToken) {
+ handleAssertStatement(Token assertKeyword,
+ Token commaToken, Token semicolonToken) {
+ Expression message;
+ if (commaToken != null) message = pop();
Expression exp = pop();
- Expression call = new CallFunction(new Identifier("assert"), [exp]);
+ var arguments = [exp];
+ if (message != null) arguments.add(message);
+ Expression call = new CallFunction(new Identifier("assert"), arguments);
push(new ExpressionStatement(call));
}

Powered by Google App Engine
This is Rietveld 408576698