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

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

Issue 11312122: Change List constructors. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Reupload. Adapt code for List.fixedLength. Created 8 years 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/lib/math_patch.dart ('k') | runtime/vm/flow_graph_builder.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 /** 5 /**
6 * [_StringBase] contains common methods used by concrete String 6 * [_StringBase] contains common methods used by concrete String
7 * implementations, e.g., _OneByteString. 7 * implementations, e.g., _OneByteString.
8 */ 8 */
9 class _StringBase { 9 class _StringBase {
10 10
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 241 }
242 return buffer.add(this.substring(startIndex)).toString(); 242 return buffer.add(this.substring(startIndex)).toString();
243 } 243 }
244 244
245 /** 245 /**
246 * Convert all objects in [values] to strings and concat them 246 * Convert all objects in [values] to strings and concat them
247 * into a result string. 247 * into a result string.
248 */ 248 */
249 static String _interpolate(List values) { 249 static String _interpolate(List values) {
250 int numValues = values.length; 250 int numValues = values.length;
251 var stringList = new List(numValues); 251 var stringList = new List.fixedLength(numValues);
252 for (int i = 0; i < numValues; i++) { 252 for (int i = 0; i < numValues; i++) {
253 stringList[i] = values[i].toString(); 253 stringList[i] = values[i].toString();
254 } 254 }
255 return _concatAll(stringList); 255 return _concatAll(stringList);
256 } 256 }
257 257
258 Iterable<Match> allMatches(String str) { 258 Iterable<Match> allMatches(String str) {
259 List<Match> result = new List<Match>(); 259 List<Match> result = new List<Match>();
260 int length = str.length; 260 int length = str.length;
261 int patternLength = this.length; 261 int patternLength = this.length;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 continue; 304 continue;
305 } 305 }
306 result.add(this.substring(previousIndex, match.start)); 306 result.add(this.substring(previousIndex, match.start));
307 startIndex = previousIndex = endIndex; 307 startIndex = previousIndex = endIndex;
308 } 308 }
309 return result; 309 return result;
310 } 310 }
311 311
312 List<String> splitChars() { 312 List<String> splitChars() {
313 int len = this.length; 313 int len = this.length;
314 final result = new List<String>(len); 314 final result = new List<String>.fixedLength(len);
315 for (int i = 0; i < len; i++) { 315 for (int i = 0; i < len; i++) {
316 result[i] = this[i]; 316 result[i] = this[i];
317 } 317 }
318 return result; 318 return result;
319 } 319 }
320 320
321 List<int> get charCodes { 321 List<int> get charCodes {
322 int len = this.length; 322 int len = this.length;
323 final result = new List<int>(len); 323 final result = new List<int>.fixedLength(len);
324 for (int i = 0; i < len; i++) { 324 for (int i = 0; i < len; i++) {
325 result[i] = this.charCodeAt(i); 325 result[i] = this.charCodeAt(i);
326 } 326 }
327 return result; 327 return result;
328 } 328 }
329 329
330 String toUpperCase() native "String_toUpperCase"; 330 String toUpperCase() native "String_toUpperCase";
331 331
332 String toLowerCase() native "String_toLowerCase"; 332 String toLowerCase() native "String_toLowerCase";
333 333
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 for (int g in groups) { 496 for (int g in groups) {
497 result.add(group(g)); 497 result.add(group(g));
498 } 498 }
499 return result; 499 return result;
500 } 500 }
501 501
502 final int start; 502 final int start;
503 final String str; 503 final String str;
504 final String pattern; 504 final String pattern;
505 } 505 }
OLDNEW
« no previous file with comments | « runtime/lib/math_patch.dart ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698