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 |
(...skipping 12 matching lines...) Expand all Loading... |
23 * | 23 * |
24 * The result is the same as would be returned by: | 24 * The result is the same as would be returned by: |
25 * | 25 * |
26 * int.parse(const String.fromEnvironment(name, defaultValue: ""), | 26 * int.parse(const String.fromEnvironment(name, defaultValue: ""), |
27 * (_) => defaultValue) | 27 * (_) => defaultValue) |
28 * | 28 * |
29 * Example: | 29 * Example: |
30 * | 30 * |
31 * const int.fromEnvironment("defaultPort", defaultValue: 80) | 31 * const int.fromEnvironment("defaultPort", defaultValue: 80) |
32 */ | 32 */ |
| 33 // The .fromEnvironment() constructors are special in that we do not want |
| 34 // users to call them using "new". We prohibit that by giving them bodies |
| 35 // that throw, even though const constructors are not allowed to have bodies. |
| 36 // Disable those static errors. |
| 37 //ignore: const_constructor_with_body |
| 38 //ignore: const_factory |
33 external const factory int.fromEnvironment(String name, {int defaultValue}); | 39 external const factory int.fromEnvironment(String name, {int defaultValue}); |
34 | 40 |
35 /** | 41 /** |
36 * Bit-wise and operator. | 42 * Bit-wise and operator. |
37 * | 43 * |
38 * Treating both `this` and [other] as sufficiently large two's component | 44 * Treating both `this` and [other] as sufficiently large two's component |
39 * integers, the result is a number with only the bits set that are set in | 45 * integers, the result is a number with only the bits set that are set in |
40 * both `this` and [other] | 46 * both `this` and [other] |
41 * | 47 * |
42 * Of both operands are negative, the result is negative, otherwise | 48 * Of both operands are negative, the result is negative, otherwise |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 * | 316 * |
311 * var value = int.parse(text, onError: (source) => null); | 317 * var value = int.parse(text, onError: (source) => null); |
312 * if (value == null) ... handle the problem | 318 * if (value == null) ... handle the problem |
313 * | 319 * |
314 * The [onError] function is only invoked if [source] is a [String]. It is | 320 * The [onError] function is only invoked if [source] is a [String]. It is |
315 * not invoked if the [source] is, for example, `null`. | 321 * not invoked if the [source] is, for example, `null`. |
316 */ | 322 */ |
317 external static int parse(String source, | 323 external static int parse(String source, |
318 {int radix, int onError(String source)}); | 324 {int radix, int onError(String source)}); |
319 } | 325 } |
OLD | NEW |