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

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: merged, and fix typo in member name 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
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;
jimhug 2011/11/07 16:41:26 I wonder if this would be better? (possibly inlin
Jennifer Messerly 2011/11/08 03:56:16 I was mostly trying to keep checked mode relativel
+}
+
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.

Powered by Google App Engine
This is Rietveld 408576698