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

Side by Side Diff: runtime/lib/integers_patch.dart

Issue 12282038: Remove deprecated string features. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head Created 7 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 | « runtime/bin/process_patch.dart ('k') | runtime/lib/mirrors_impl.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 // Dart core library. 4 // Dart core library.
5 5
6 // VM implementation of int. 6 // VM implementation of int.
7 7
8 patch class int { 8 patch class int {
9 static int _parse(String str) native "Integer_parse"; 9 static int _parse(String str) native "Integer_parse";
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 const NA = 99; 43 const NA = 99;
44 const List<int> digits = const <int>[ 44 const List<int> digits = const <int>[
45 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, NA, NA, NA, NA, NA, NA, // 0x30 45 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, NA, NA, NA, NA, NA, NA, // 0x30
46 NA, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 0x40 46 NA, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 0x40
47 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, NA, NA, NA, NA, NA, // 0x50 47 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, NA, NA, NA, NA, NA, // 0x50
48 NA, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 0x60 48 NA, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 0x60
49 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, NA, NA, NA, NA, NA, // 0x70 49 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, NA, NA, NA, NA, NA, // 0x70
50 ]; 50 ];
51 51
52 int i = 0; 52 int i = 0;
53 int code = source.charCodeAt(i); 53 int code = source.codeUnitAt(i);
54 if (code == 0x2d || code == 0x2b) { // Starts with a plus or minus-sign. 54 if (code == 0x2d || code == 0x2b) { // Starts with a plus or minus-sign.
55 negative = (code == 0x2d); 55 negative = (code == 0x2d);
56 if (source.length == 1) return onError(source); 56 if (source.length == 1) return onError(source);
57 i = 1; 57 i = 1;
58 code = source.charCodeAt(i); 58 code = source.codeUnitAt(i);
59 } 59 }
60 do { 60 do {
61 if (code < 0x30 || code > 0x7f) return onError(source); 61 if (code < 0x30 || code > 0x7f) return onError(source);
62 int digit = digits[code - 0x30]; 62 int digit = digits[code - 0x30];
63 if (digit >= radix) return onError(source); 63 if (digit >= radix) return onError(source);
64 result = result * radix + digit; 64 result = result * radix + digit;
65 i++; 65 i++;
66 if (i == source.length) break; 66 if (i == source.length) break;
67 code = source.charCodeAt(i); 67 code = source.codeUnitAt(i);
68 } while (true); 68 } while (true);
69 return negative ? -result : result; 69 return negative ? -result : result;
70 } 70 }
71 } 71 }
OLDNEW
« no previous file with comments | « runtime/bin/process_patch.dart ('k') | runtime/lib/mirrors_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698