Chromium Code Reviews| 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 dart.core; | 5 part of dart.core; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * An arbitrarily large integer. | 8 * An arbitrarily large integer. |
| 9 * | 9 * |
| 10 * **Note:** When compiling to JavaScript, integers are | 10 * **Note:** When compiling to JavaScript, integers are |
| 11 * implemented as JavaScript numbers. When compiling to JavaScript, | 11 * implemented as JavaScript numbers. When compiling to JavaScript, |
| 12 * integers are therefore restricted to 53 significant bits because | 12 * integers are therefore restricted to 53 significant bits because |
| 13 * all JavaScript numbers are double-precision floating point | 13 * all JavaScript numbers are double-precision floating point |
| 14 * values. The behavior of the operators and methods in the [int] | 14 * values. The behavior of the operators and methods in the [int] |
| 15 * class therefore sometimes differs between the Dart VM and Dart code | 15 * class therefore sometimes differs between the Dart VM and Dart code |
| 16 * compiled to JavaScript. | 16 * compiled to JavaScript. |
| 17 * | 17 * |
| 18 * It is a compile-time error for a class to attempt to extend or implement int. | 18 * It is a compile-time error for a class to attempt to extend or implement int. |
| 19 */ | 19 */ |
| 20 abstract class int extends num { | 20 abstract class int extends num { |
| 21 /** | 21 /** |
| 22 * Returns the integer value of the given environment declaration [name]. | |
| 23 * | |
| 24 * if `name` is not declared, the result is [defaultValue]. | |
| 25 * | |
| 26 * Throws a [FormatException] if the value in the environment is not a valid | |
|
Søren Gjesse
2013/10/31 08:14:30
The VM implementation currently throws ArgumentErr
Lasse Reichstein Nielsen
2013/10/31 11:52:19
It also fails on other parts of the parsing. We sh
| |
| 27 * integer, as accepted by [parse] with no radix. | |
| 28 * | |
| 29 * Example: | |
| 30 * | |
| 31 * const int.fromEnvironment("defaultPort", defaultValue: 80) | |
| 32 */ | |
| 33 external const factory int.fromEnvironment(String name, {int defaultValue}); | |
| 34 | |
| 35 /** | |
| 22 * Bit-wise and operator. | 36 * Bit-wise and operator. |
| 23 * | 37 * |
| 24 * Treating both `this` and [other] as sufficiently large two's component | 38 * Treating both `this` and [other] as sufficiently large two's component |
| 25 * integers, the result is a number with only the bits set that are set in | 39 * integers, the result is a number with only the bits set that are set in |
| 26 * both `this` and [other] | 40 * both `this` and [other] |
| 27 * | 41 * |
| 28 * Of both operands are negative, the result is negative, otherwise | 42 * Of both operands are negative, the result is negative, otherwise |
| 29 * the result is non-negative. | 43 * the result is non-negative. |
| 30 */ | 44 */ |
| 31 int operator &(int other); | 45 int operator &(int other); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 * sign, the [onError] is called with the [source] as argument, and its return | 259 * sign, the [onError] is called with the [source] as argument, and its return |
| 246 * value is used instead. If no [onError] is provided, a [FormatException] | 260 * value is used instead. If no [onError] is provided, a [FormatException] |
| 247 * is thrown. | 261 * is thrown. |
| 248 * | 262 * |
| 249 * The [onError] function is only invoked if [source] is a [String]. It is | 263 * The [onError] function is only invoked if [source] is a [String]. It is |
| 250 * not invoked if the [source] is, for example, `null`. | 264 * not invoked if the [source] is, for example, `null`. |
| 251 */ | 265 */ |
| 252 external static int parse(String source, | 266 external static int parse(String source, |
| 253 { int radix, | 267 { int radix, |
| 254 int onError(String source) }); | 268 int onError(String source) }); |
| 255 | |
| 256 /** | |
| 257 * Returns the integer value for the given environment variable | |
| 258 * [name] or [defaultValue] if [name] is not present. If the value | |
| 259 * of the environment variable is not a valid integer literal a | |
| 260 * [FormatException] is thrown. | |
| 261 */ | |
| 262 external const factory int.fromEnvironment(String name, {int defaultValue}); | |
| 263 } | 269 } |
| OLD | NEW |