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

Unified Diff: runtime/lib/string_base.dart

Issue 12431010: Fix String.fromCharCodes to work with iterables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 8ed74b6413dd969022f5494f14818512e1c5c3b0..545c16443ca41bc84bf2f083d22b9ef61c684278 100644
--- a/runtime/lib/string_base.dart
+++ b/runtime/lib/string_base.dart
@@ -19,18 +19,11 @@ class _StringBase {
* Create the most efficient string representation for specified
* [codePoints].
*/
- static String createFromCharCodes(List<int> charCodes) {
- _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];
- }
+ static String createFromCharCodes(Iterable<int> charCodes) {
+ if (charCodes is! _ObjectArray) {
+ charCodes = new List<int>.from(charCodes, growable: false);
floitsch 2013/03/05 14:14:04 assert that it is an _ObjectArray afterwards. (It'
}
- return _createFromCodePoints(objectArray);
+ return _createFromCodePoints(charCodes);
}
static String _createFromCodePoints(List<int> codePoints)
« no previous file with comments | « no previous file | runtime/lib/string_patch.dart » ('j') | sdk/lib/_internal/compiler/implementation/lib/core_patch.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698