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

Unified Diff: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart

Issue 2568313002: Implement messages in assert() in dev_compiler. (Closed)
Patch Set: 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
Index: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
index 0e3acaf539e93fd4692da3833e2ab2b24491be9b..a3c80f0527d3ba85e80095d7b25a3ef7cec48911 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
@@ -312,7 +312,8 @@ dsend(obj, method, @rest args) => _callMethod(obj, method, null, args, method);
dgsend(obj, typeArgs, method, @rest args) =>
_callMethod(obj, method, typeArgs, args, method);
-dindex(obj, index) => _callMethod(obj, '_get', null, JS('', '[#]', index), '[]');
+dindex(obj, index) =>
+ _callMethod(obj, '_get', null, JS('', '[#]', index), '[]');
dsetindex(obj, index, value) =>
_callMethod(obj, '_set', null, JS('', '[#, #]', index, value), '[]=');
@@ -552,6 +553,13 @@ assert_(condition) => JS(
if (!$condition) $throwAssertionError();
Jennifer Messerly 2016/12/12 22:36:02 here's how I would change this: assert_(condition
Bob Nystrom 2016/12/13 19:29:51 Done.
})()''');
+@JSExportName('assertMessage')
+assertMessage_(condition, message) => JS(
Jennifer Messerly 2016/12/12 22:36:02 this can be removed per earlier suggestions
Bob Nystrom 2016/12/13 19:29:51 Done.
+ '',
+ '''(() => {
+ if (!$condition) $throwAssertionErrorWithMessage(message());
+})()''');
+
var _stack = null;
@JSExportName('throw')
throw_(obj) => JS(

Powered by Google App Engine
This is Rietveld 408576698