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

Unified Diff: compiler/lib/implementation/number.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/number.js
===================================================================
--- compiler/lib/implementation/number.js (revision 400)
+++ compiler/lib/implementation/number.js (working copy)
@@ -84,14 +84,7 @@
}
function native_NumberImplementation_EQ(other) {
- if (typeof other == 'number') {
- return this == other;
- } else if (other instanceof Number) {
- // Must convert other to a primitive for value equality to work
- return this == Number(other);
- } else {
- return false;
- }
+ return typeof other == 'number' && this == other;
floitsch 2011/10/14 20:20:44 Same as for booleans: operator$EQ should intercept
John Lenz 2011/10/14 21:26:40 It is already special cased in EQ$operator, but I'
}
function native_NumberImplementation_BIT_NOT() {
@@ -124,6 +117,10 @@
return (this == Infinity) || (this == -Infinity);
}
+function native_NumberImplementation_toDouble() {
+ return this.valueOf();
+}
+
function native_NumberImplementation_toString() {
return this.toString();
}

Powered by Google App Engine
This is Rietveld 408576698