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 library dart._internal; | 5 library dart._internal; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'dart:core' hide Symbol; | 9 import 'dart:core' hide Symbol; |
10 import 'dart:core' as core; | 10 import 'dart:core' as core; |
11 import 'dart:math' show Random; | 11 import 'dart:math' show Random; |
12 | 12 |
13 part 'iterable.dart'; | 13 part 'iterable.dart'; |
14 part 'list.dart'; | 14 part 'list.dart'; |
15 part 'print.dart'; | 15 part 'print.dart'; |
16 part 'sort.dart'; | 16 part 'sort.dart'; |
17 part 'symbol.dart'; | 17 part 'symbol.dart'; |
18 | 18 |
19 // Powers of 10 up to 10^22 are representable as doubles. | 19 // Powers of 10 up to 10^22 are representable as doubles. |
20 // Powers of 10 above that are only approximate due to lack of precission. | 20 // Powers of 10 above that are only approximate due to lack of precission. |
21 // Used by double-parsing. | 21 // Used by double-parsing. |
22 const POWERS_OF_TEN = const [ | 22 const POWERS_OF_TEN = const [ |
23 1.0, /* 0 */ | 23 1.0, |
24 10.0, | 24 /* 0 */ |
floitsch
2017/04/19 09:34:19
These comments are on the wrong line.
| |
25 100.0, | 25 10.0, |
26 1000.0, | 26 100.0, |
27 10000.0, | 27 1000.0, |
28 100000.0, /* 5 */ | 28 10000.0, |
29 1000000.0, | 29 100000.0, |
30 10000000.0, | 30 /* 5 */ |
31 100000000.0, | 31 1000000.0, |
32 1000000000.0, | 32 10000000.0, |
33 10000000000.0, /* 10 */ | 33 100000000.0, |
34 100000000000.0, | 34 1000000000.0, |
35 1000000000000.0, | 35 10000000000.0, |
36 10000000000000.0, | 36 /* 10 */ |
37 100000000000000.0, | 37 100000000000.0, |
38 1000000000000000.0, /* 15 */ | 38 1000000000000.0, |
39 10000000000000000.0, | 39 10000000000000.0, |
40 100000000000000000.0, | 40 100000000000000.0, |
41 1000000000000000000.0, | 41 1000000000000000.0, |
42 10000000000000000000.0, | 42 /* 15 */ |
43 100000000000000000000.0, /* 20 */ | 43 10000000000000000.0, |
44 1000000000000000000000.0, | 44 100000000000000000.0, |
45 1000000000000000000.0, | |
46 10000000000000000000.0, | |
47 100000000000000000000.0, | |
48 /* 20 */ | |
49 1000000000000000000000.0, | |
45 10000000000000000000000.0, | 50 10000000000000000000000.0, |
46 ]; | 51 ]; |
47 | 52 |
48 /** | 53 /** |
49 * An [Iterable] of the UTF-16 code units of a [String] in index order. | 54 * An [Iterable] of the UTF-16 code units of a [String] in index order. |
50 */ | 55 */ |
51 class CodeUnits extends UnmodifiableListBase<int> { | 56 class CodeUnits extends UnmodifiableListBase<int> { |
52 /** The string that this is the code units of. */ | 57 /** The string that this is the code units of. */ |
53 final String _string; | 58 final String _string; |
54 | 59 |
55 CodeUnits(this._string); | 60 CodeUnits(this._string); |
56 | 61 |
57 int get length => _string.length; | 62 int get length => _string.length; |
58 int operator[](int i) => _string.codeUnitAt(i); | 63 int operator [](int i) => _string.codeUnitAt(i); |
59 | 64 |
60 static String stringOf(CodeUnits u) => u._string; | 65 static String stringOf(CodeUnits u) => u._string; |
61 } | 66 } |
62 | 67 |
63 /// Marks a function as an external implementation ("native" in the Dart VM). | 68 /// Marks a function as an external implementation ("native" in the Dart VM). |
64 /// | 69 /// |
65 /// Provides a backend-specific String that can be used to identify the | 70 /// Provides a backend-specific String that can be used to identify the |
66 /// function's implementation. | 71 /// function's implementation. |
67 class ExternalName { | 72 class ExternalName { |
68 final String name; | 73 final String name; |
(...skipping 19 matching lines...) Expand all Loading... | |
88 | 93 |
89 /// Parses two hex digits in a string. | 94 /// Parses two hex digits in a string. |
90 /// | 95 /// |
91 /// Returns a negative value if either digit isn't valid. | 96 /// Returns a negative value if either digit isn't valid. |
92 int parseHexByte(String source, int index) { | 97 int parseHexByte(String source, int index) { |
93 assert(index + 2 <= source.length); | 98 assert(index + 2 <= source.length); |
94 int digit1 = hexDigitValue(source.codeUnitAt(index)); | 99 int digit1 = hexDigitValue(source.codeUnitAt(index)); |
95 int digit2 = hexDigitValue(source.codeUnitAt(index + 1)); | 100 int digit2 = hexDigitValue(source.codeUnitAt(index + 1)); |
96 return digit1 * 16 + digit2 - (digit2 & 256); | 101 return digit1 * 16 + digit2 - (digit2 & 256); |
97 } | 102 } |
OLD | NEW |