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

Unified Diff: runtime/lib/string_base.dart

Issue 11348035: Move StringImplementation from coreimpl to core as _StringImpl. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: runtime/lib/string_base.dart
diff --git a/runtime/lib/string_base.dart b/runtime/lib/string_base.dart
index dc417473f6988df8bacbdc7a3afe99d477f35026..9f485460dd176e21b1a12f20f01a493bfd97100c 100644
--- a/runtime/lib/string_base.dart
+++ b/runtime/lib/string_base.dart
@@ -20,11 +20,15 @@ class _StringBase {
* [codePoints].
*/
static String createFromCharCodes(List<int> charCodes) {
- // TODO(ajohnsen): Add fast path once string_base is in core.
- int len = charCodes.length;
- var objectArray = new List(len);
- for (int i = 0; i < len; i++) {
- objectArray[i] = charCodes[i];
+ _ObjectArray objectArray;
+ if (charCodes is _ObjectArray) {
+ objectArray = charCodes;
+ } else {
+ int len = charCodes.length;
+ objectArray = new _ObjectArray(len);
+ for (int i = 0; i < len; i++) {
+ objectArray[i] = charCodes[i];
+ }
}
return _createFromCodePoints(objectArray);
}
@@ -332,11 +336,15 @@ class _StringBase {
}
static String concatAll(List<String> strings) {
- // TODO(ajohnsen): Add fast path once string_base is in core.
- int len = strings.length;
- var stringsArray = new List(len);
- for (int i = 0; i < len; i++) {
- stringsArray[i] = strings[i];
+ _ObjectArray stringsArray;
+ if (strings is _ObjectArray) {
+ stringsArray = strings;
+ } else {
+ int len = strings.length;
+ stringsArray = new _ObjectArray(len);
+ for (int i = 0; i < len; i++) {
+ stringsArray[i] = strings[i];
+ }
}
return _concatAll(stringsArray);
}

Powered by Google App Engine
This is Rietveld 408576698