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 const int _maxAscii = 0x7f; | 5 const int _maxAscii = 0x7f; |
6 const int _maxLatin1 = 0xff; | 6 const int _maxLatin1 = 0xff; |
7 const int _maxUtf16 = 0xffff; | 7 const int _maxUtf16 = 0xffff; |
8 const int _maxUnicode = 0x10ffff; | 8 const int _maxUnicode = 0x10ffff; |
9 | 9 |
10 patch class String { | 10 patch class String { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 int code = charCodes[i]; | 150 int code = charCodes[i]; |
151 if (code is! _Smi) throw new ArgumentError(charCodes); | 151 if (code is! _Smi) throw new ArgumentError(charCodes); |
152 bits |= code; | 152 bits |= code; |
153 } | 153 } |
154 return bits; | 154 return bits; |
155 } | 155 } |
156 | 156 |
157 static String _createStringFromIterable(Iterable<int> charCodes, | 157 static String _createStringFromIterable(Iterable<int> charCodes, |
158 int start, int end) { | 158 int start, int end) { |
159 // Treat charCodes as Iterable. | 159 // Treat charCodes as Iterable. |
160 if (charCodes is EfficientLength) { | 160 if (charCodes is EfficientLengthIterable) { |
161 int length = charCodes.length; | 161 int length = charCodes.length; |
162 end = RangeError.checkValidRange(start, end, length); | 162 end = RangeError.checkValidRange(start, end, length); |
163 List charCodeList = new List.from(charCodes.take(end).skip(start), | 163 List charCodeList = new List.from(charCodes.take(end).skip(start), |
164 growable: false); | 164 growable: false); |
165 return createFromCharCodes(charCodeList, 0, charCodeList.length, null); | 165 return createFromCharCodes(charCodeList, 0, charCodeList.length, null); |
166 } | 166 } |
167 // Don't know length of iterable, so iterate and see if all the values | 167 // Don't know length of iterable, so iterate and see if all the values |
168 // are there. | 168 // are there. |
169 if (start < 0) throw new RangeError.range(start, 0, charCodes.length); | 169 if (start < 0) throw new RangeError.range(start, 0, charCodes.length); |
170 var it = charCodes.iterator; | 170 var it = charCodes.iterator; |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 for (int g in groups) { | 1314 for (int g in groups) { |
1315 result.add(group(g)); | 1315 result.add(group(g)); |
1316 } | 1316 } |
1317 return result; | 1317 return result; |
1318 } | 1318 } |
1319 | 1319 |
1320 final int start; | 1320 final int start; |
1321 final String input; | 1321 final String input; |
1322 final String pattern; | 1322 final String pattern; |
1323 } | 1323 } |
OLD | NEW |