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

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

Issue 8286001: Changes "is" and equality checks to strictly check for primitive types, fix a couple of (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/bool.js
===================================================================
--- compiler/lib/implementation/bool.js (revision 400)
+++ compiler/lib/implementation/bool.js (working copy)
@@ -2,19 +2,14 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-
-
function native_BoolImplementation_EQ(other) {
floitsch 2011/10/14 20:20:44 maybe for another CL, but ideally we should never
John Lenz 2011/10/14 21:26:40 yes. I leave that for another CL. After we have go
- if (typeof other == 'boolean') {
- return this == other;
- } else if (other instanceof Boolean) {
- // Must convert other to a primitive for value equality to work
- return this == Boolean(other);
- } else {
- return false;
- }
+ return typeof other == 'boolean' && this == other;
}
function native_BoolImplementation_toString() {
floitsch 2011/10/14 20:20:44 Same is true here. Since we already need to interc
John Lenz 2011/10/14 21:26:40 true, there is less need for this to be special ca
- return (this == true) ? "true" : "false";
+ return this.toString();
}
+
+function native_BoolImplementation_toBool() {
+ return this == true;
+}

Powered by Google App Engine
This is Rietveld 408576698