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

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

Issue 9960084: Introduce a flag to disable string operator + (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 implementations, 6 * [StringBase] contains common methods used by concrete String implementations,
7 * e.g., OneByteString. 7 * e.g., OneByteString.
8 */ 8 */
9 class StringBase { 9 class StringBase {
10 10
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 StringBuffer buffer = new StringBuffer(); 226 StringBuffer buffer = new StringBuffer();
227 int startIndex = 0; 227 int startIndex = 0;
228 for (Match match in pattern.allMatches(this)) { 228 for (Match match in pattern.allMatches(this)) {
229 buffer.add(this.substring(startIndex, match.start())).add(replacement); 229 buffer.add(this.substring(startIndex, match.start())).add(replacement);
230 startIndex = match.end(); 230 startIndex = match.end();
231 } 231 }
232 return buffer.add(this.substring(startIndex)).toString(); 232 return buffer.add(this.substring(startIndex)).toString();
233 } 233 }
234 234
235 /** 235 /**
236 * TODO(hausner): remove support for operator + and native method plus().
237 */
238 String plus(String other) native "String_plus";
239
240 /**
236 * Convert argument obj to string and concat it with this string. 241 * Convert argument obj to string and concat it with this string.
237 * Returns concatenated string. 242 * Returns concatenated string.
243 * TODO(hausner): remove support for +.
238 */ 244 */
239 String operator +(Object obj) { 245 String operator +(Object obj) {
240 return this.concat(obj.toString()); 246 return this.plus(obj.toString());
241 } 247 }
242 248
243 /** 249 /**
244 * Convert all objects in [values] to strings and concat them 250 * Convert all objects in [values] to strings and concat them
245 * into a result string. 251 * into a result string.
246 */ 252 */
247 static String _interpolate(List values) { 253 static String _interpolate(List values) {
248 int numValues = values.length; 254 int numValues = values.length;
249 List<String> stringList = new List<String>(numValues); 255 List<String> stringList = new List<String>(numValues);
250 int resultLength = 0; 256 int resultLength = 0;
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 for (int g in groups) { 511 for (int g in groups) {
506 result.add(group(g)); 512 result.add(group(g));
507 } 513 }
508 return result; 514 return result;
509 } 515 }
510 516
511 final int _start; 517 final int _start;
512 final String str; 518 final String str;
513 final String pattern; 519 final String pattern;
514 } 520 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698