Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 } | |
| OLD | NEW |