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

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

Issue 1154263003: Revert "Make EfficientLength public, as EfficientLengthIterable." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « runtime/lib/immutable_map.dart ('k') | runtime/vm/debugger_api_impl_test.cc » ('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 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
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 EfficientLengthIterable) { 160 if (charCodes is EfficientLength) {
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
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 }
OLDNEW
« no previous file with comments | « runtime/lib/immutable_map.dart ('k') | runtime/vm/debugger_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698