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

Unified Diff: frog/lib/core.js

Issue 8457007: Better runtime type checks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: cleaner output Created 9 years, 1 month 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 | « frog/gen.dart ('k') | frog/lib/num.dart » ('j') | frog/library.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/lib/core.js
diff --git a/frog/lib/core.js b/frog/lib/core.js
index 3f5a872d20b2612ba7b890d87dd0d8a912bc2f15..48b2b1370d1275ca75bcb08dc1183397920cade7 100644
--- a/frog/lib/core.js
+++ b/frog/lib/core.js
@@ -174,6 +174,13 @@ function $assert(test, text, url, line, column) {
if (!test) $throw(new AssertError(text, url, line, column));
}
+function $notnull_bool(test) {
+ if (test == null || typeof(test) != 'boolean') {
+ $throw(new TypeError('must be "true" or "false"'));
+ }
+ return test === true;
+}
+
function $throw(e) {
// If e is not a value, we can use V8's captureStackTrace utility method.
// TODO(jmesserly): capture the stack trace on other JS engines.
« no previous file with comments | « frog/gen.dart ('k') | frog/lib/num.dart » ('j') | frog/library.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698