Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: sdk/lib/core/int.dart

Issue 988523002: Fix int.parse bug (dart2js version) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/js_number.dart ('k') | tests/corelib/double_parse_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 * optionally prefixed with a minus or plus sign ('-' or '+'). 270 * optionally prefixed with a minus or plus sign ('-' or '+').
271 * 271 *
272 * It must always be the case for an int [:n:] and radix [:r:] that 272 * It must always be the case for an int [:n:] and radix [:r:] that
273 * [:n == int.parse(n.toRadixString(r), radix: r):]. 273 * [:n == int.parse(n.toRadixString(r), radix: r):].
274 * 274 *
275 * If the [source] is not a valid integer literal, optionally prefixed by a 275 * If the [source] is not a valid integer literal, optionally prefixed by a
276 * sign, the [onError] is called with the [source] as argument, and its return 276 * sign, the [onError] is called with the [source] as argument, and its return
277 * value is used instead. If no [onError] is provided, a [FormatException] 277 * value is used instead. If no [onError] is provided, a [FormatException]
278 * is thrown. 278 * is thrown.
279 * 279 *
280 * The [onError] handler can be chosen to return `null`. This is preferable
281 * to to throwing and then immediately catching the [FormatException].
282 * Example:
283 *
284 * var value = int.parse(text, onError: (source) => null);
285 * if (value == null) ... handle the problem
286 *
280 * The [onError] function is only invoked if [source] is a [String]. It is 287 * The [onError] function is only invoked if [source] is a [String]. It is
281 * not invoked if the [source] is, for example, `null`. 288 * not invoked if the [source] is, for example, `null`.
282 */ 289 */
283 external static int parse(String source, 290 external static int parse(String source,
284 { int radix, 291 { int radix,
285 int onError(String source) }); 292 int onError(String source) });
286 } 293 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/js_number.dart ('k') | tests/corelib/double_parse_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698