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

Unified Diff: sdk/lib/_internal/js_runtime/lib/js_helper.dart

Issue 1325843003: Add optional message to assert in Dart2js. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address comments 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: sdk/lib/_internal/js_runtime/lib/js_helper.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/js_helper.dart b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
index 6692d2723c426a4e4f984899aac1ac55fb05e77b..65f603d5b5aeb25abf39e32478faf7f44211999d 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
@@ -3301,7 +3301,7 @@ class FallThroughErrorImplementation extends FallThroughError {
/**
* Helper function for implementing asserts. The compiler treats this specially.
*/
-void assertHelper(condition) {
+bool assertConditionHelper(condition) {
// Do a bool check first because it is common and faster than 'is Function'.
if (condition is !bool) {
if (condition is Function) condition = condition();
@@ -3311,7 +3311,14 @@ void assertHelper(condition) {
}
// Compare to true to avoid boolean conversion check in checked
// mode.
- if (true != condition) throw new AssertionError();
+ return (true == condition);
+}
+
+/**
+ * Helper function for implementing asserts. The compiler treats this specially.
+ */
+void assertThrowHelper(Object message) {
+ throw new AssertionError(message);
}
/**

Powered by Google App Engine
This is Rietveld 408576698