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

Unified Diff: pkg/dev_compiler/lib/src/compiler/code_generator.dart

Issue 2568313002: Implement messages in assert() in dev_compiler. (Closed)
Patch Set: Format. Created 4 years 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/dev_compiler/lib/sdk/ddc_sdk.sum ('k') | pkg/dev_compiler/lib/src/compiler/command.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/lib/src/compiler/code_generator.dart
diff --git a/pkg/dev_compiler/lib/src/compiler/code_generator.dart b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
index b2f28d02be128a17d755fde38a578af25902e6ff..078f18e1eec2dc0a2b0d292ceb06c11a046c12d7 100644
--- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
@@ -3819,9 +3819,15 @@ class CodeGenerator extends GeneralizingAstVisitor
new JS.EmptyStatement();
@override
- JS.Statement visitAssertStatement(AssertStatement node) =>
- // TODO(jmesserly): only emit in checked mode.
- _callHelperStatement('assert(#);', _visit(node.condition));
+ JS.Statement visitAssertStatement(AssertStatement node) {
+ // TODO(jmesserly): only emit in checked mode.
+ if (node.message != null) {
+ return _callHelperStatement('assert(#, () => #);',
+ [_visit(node.condition), _visit(node.message)]);
+ }
+
+ return _callHelperStatement('assert(#);', _visit(node.condition));
+ }
@override
JS.Statement visitReturnStatement(ReturnStatement node) {
« no previous file with comments | « pkg/dev_compiler/lib/sdk/ddc_sdk.sum ('k') | pkg/dev_compiler/lib/src/compiler/command.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698