| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 // Adds Dart-methods to the prototype of the JS Boolean function. | |
| 6 // TODO(floitsch): the following comment needs to be updated once we compile | |
| 7 // boolean checks with '=== true'. | |
| 8 // WARNING: 'this' inside this class is always treated as 'true'. | |
| 9 // That is if (this) ... will always pick the 'then' branch. | |
| 10 // The reason is that, once compiled to JS, 'this' is represented by a | |
| 11 // JS Boolean object. However "if (new Boolean(false)) .." picks the then | |
| 12 // branch. | |
| 13 class BoolImplementation implements bool native "Boolean" { | |
| 14 bool operator ==(other) native; | |
| 15 | |
| 16 // TODO(floitsch): we should intercept toString for primitives, to avoid | |
| 17 // creating a wrapper object. | |
| 18 String toString() native; | |
| 19 | |
| 20 BoolImplementation toBool() native; | |
| 21 | |
| 22 get dynamic() { return toBool(); } | |
| 23 } | |
| OLD | NEW |