| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of _interceptors; | 5 part of _interceptors; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * The super interceptor class for [JSInt] and [JSDouble]. The compiler | 8 * The super interceptor class for [JSInt] and [JSDouble]. The compiler |
| 9 * recognizes this class as an interceptor, and changes references to | 9 * recognizes this class as an interceptor, and changes references to |
| 10 * [:this:] to actually use the receiver of the method, which is | 10 * [:this:] to actually use the receiver of the method, which is |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 | 302 |
| 303 bool operator <=(num other) { | 303 bool operator <=(num other) { |
| 304 if (other is !num) throw new ArgumentError(other); | 304 if (other is !num) throw new ArgumentError(other); |
| 305 return JS('bool', '# <= #', this, other); | 305 return JS('bool', '# <= #', this, other); |
| 306 } | 306 } |
| 307 | 307 |
| 308 bool operator >=(num other) { | 308 bool operator >=(num other) { |
| 309 if (other is !num) throw new ArgumentError(other); | 309 if (other is !num) throw new ArgumentError(other); |
| 310 return JS('bool', '# >= #', this, other); | 310 return JS('bool', '# >= #', this, other); |
| 311 } | 311 } |
| 312 |
| 313 Type get runtimeType => num; |
| 312 } | 314 } |
| 313 | 315 |
| 314 /** | 316 /** |
| 315 * The interceptor class for [int]s. | 317 * The interceptor class for [int]s. |
| 316 * | 318 * |
| 317 * This class implements double since in JavaScript all numbers are doubles, so | 319 * This class implements double since in JavaScript all numbers are doubles, so |
| 318 * while we want to treat `2.0` as an integer for some operations, its | 320 * while we want to treat `2.0` as an integer for some operations, its |
| 319 * interceptor should answer `true` to `is double`. | 321 * interceptor should answer `true` to `is double`. |
| 320 */ | 322 */ |
| 321 class JSInt extends JSNumber implements int, double { | 323 class JSInt extends JSNumber implements int, double { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 } | 392 } |
| 391 | 393 |
| 392 class JSDouble extends JSNumber implements double { | 394 class JSDouble extends JSNumber implements double { |
| 393 const JSDouble(); | 395 const JSDouble(); |
| 394 Type get runtimeType => double; | 396 Type get runtimeType => double; |
| 395 } | 397 } |
| 396 | 398 |
| 397 class JSPositiveInt extends JSInt {} | 399 class JSPositiveInt extends JSInt {} |
| 398 class JSUInt32 extends JSPositiveInt {} | 400 class JSUInt32 extends JSPositiveInt {} |
| 399 class JSUInt31 extends JSUInt32 {} | 401 class JSUInt31 extends JSUInt32 {} |
| OLD | NEW |