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

Unified Diff: frog/corejs.dart

Issue 8463027: Optimize boolean asserts (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: co19 status 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 | « no previous file | frog/frogsh » ('j') | frog/frogsh » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/corejs.dart
diff --git a/frog/corejs.dart b/frog/corejs.dart
index 587f9215ada53fc572e0625822622ae78176038e..690201b258cc8e6658458e538c8fcd50cee7e908 100644
--- a/frog/corejs.dart
+++ b/frog/corejs.dart
@@ -287,10 +287,11 @@ function $toDartException(e) {
if (useNotNullBool) {
useThrow = true;
- // Some testing showed that this patterned fared well across browsers.
+ // This pattern chosen because IE9 does really badly with typeof, and
+ // it's still decent on other browsers.
w.writeln(@"""
function $notnull_bool(test) {
- return typeof(test) == 'boolean' ? test : test.is$bool();
+ return (test === true || test === false) ? test : test.is$bool();
}""");
}
« no previous file with comments | « no previous file | frog/frogsh » ('j') | frog/frogsh » ('J')

Powered by Google App Engine
This is Rietveld 408576698