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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5
6
7 function native_BoolImplementation_EQ(other) { 5 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
8 if (typeof other == 'boolean') { 6 return typeof other == 'boolean' && this == other;
9 return this == other;
10 } else if (other instanceof Boolean) {
11 // Must convert other to a primitive for value equality to work
12 return this == Boolean(other);
13 } else {
14 return false;
15 }
16 } 7 }
17 8
18 function native_BoolImplementation_toString() { 9 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
19 return (this == true) ? "true" : "false"; 10 return this.toString();
20 } 11 }
12
13 function native_BoolImplementation_toBool() {
14 return this == true;
15 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698