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

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

Issue 563973004: Call special VM interpolate for single element interpolation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | runtime/vm/flow_graph_builder.cc » ('J')
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 patch class String { 5 patch class String {
6 /* patch */ factory String.fromCharCodes(Iterable<int> charCodes) { 6 /* patch */ factory String.fromCharCodes(Iterable<int> charCodes) {
7 return _StringBase.createFromCharCodes(charCodes); 7 return _StringBase.createFromCharCodes(charCodes);
8 } 8 }
9 9
10 /* patch */ factory String.fromCharCode(int charCode) { 10 /* patch */ factory String.fromCharCode(int charCode) {
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 int startIndex = 0; 511 int startIndex = 0;
512 for (Match match in pattern.allMatches(this)) { 512 for (Match match in pattern.allMatches(this)) {
513 buffer.write(onNonMatch(this.substring(startIndex, match.start))); 513 buffer.write(onNonMatch(this.substring(startIndex, match.start)));
514 buffer.write(onMatch(match).toString()); 514 buffer.write(onMatch(match).toString());
515 startIndex = match.end; 515 startIndex = match.end;
516 } 516 }
517 buffer.write(onNonMatch(this.substring(startIndex))); 517 buffer.write(onNonMatch(this.substring(startIndex)));
518 return buffer.toString(); 518 return buffer.toString();
519 } 519 }
520 520
521 // Convert single object to string.
522 static String _interpolateSingle(final Object o) {
Florian Schneider 2014/09/12 10:33:37 final is not really necessary here.
Lasse Reichstein Nielsen 2014/09/12 12:49:38 Done.
523 final s = o.toString();
524 if (s is! String) {
525 throw new ArgumentError(o);
526 }
527 return s;
528 }
521 529
522 /** 530 /**
523 * Convert all objects in [values] to strings and concat them 531 * Convert all objects in [values] to strings and concat them
524 * into a result string. 532 * into a result string.
525 */ 533 */
526 static String _interpolate(List<String> values) { 534 static String _interpolate(List<String> values) {
527 final numValues = values.length; 535 final numValues = values.length;
528 _List stringList = new List<String>(numValues); 536 _List stringList = new List<String>(numValues);
529 bool isOneByteString = true; 537 bool isOneByteString = true;
530 int totalLength = 0; 538 int totalLength = 0;
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 class _CodeUnits extends Object with ListMixin<int>, 1018 class _CodeUnits extends Object with ListMixin<int>,
1011 UnmodifiableListMixin<int> { 1019 UnmodifiableListMixin<int> {
1012 /** The string that this is the code units of. */ 1020 /** The string that this is the code units of. */
1013 String _string; 1021 String _string;
1014 1022
1015 _CodeUnits(this._string); 1023 _CodeUnits(this._string);
1016 1024
1017 int get length => _string.length; 1025 int get length => _string.length;
1018 int operator[](int i) => _string.codeUnitAt(i); 1026 int operator[](int i) => _string.codeUnitAt(i);
1019 } 1027 }
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | runtime/vm/flow_graph_builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698