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

Unified Diff: compiler/lib/implementation/core.js

Issue 8276014: Update assert to follow the spec. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 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: compiler/lib/implementation/core.js
===================================================================
--- compiler/lib/implementation/core.js (revision 409)
+++ compiler/lib/implementation/core.js (working copy)
@@ -181,13 +181,10 @@
*/
var $Dart$Null = void 0;
-function assert(expr, msg) {
- var val = typeof(expr) == 'function' ? expr() : expr;
- if (!val) {
- // TODO: throw a Dart AssertionError instead
- var err = new Error('Assertion failed. ' + (msg || ''));
- Error.captureStackTrace && Error.captureStackTrace(err);
- throw err;
+function assert(expr) {
+ var val = typeof(expr) == 'function' ? $dartcall(expr, []) : expr;
+ if (val !== true) {
+ $Dart$ThrowException(native_ExceptionHelper_createAssertionError());
}
}

Powered by Google App Engine
This is Rietveld 408576698