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

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

Issue 12632014: Allow String.fromCharCodes to work directly on a GrowableObjectArray. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments. Created 7 years, 9 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 | « runtime/lib/string.cc ('k') | no next file » | 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
11 factory _StringBase._uninstantiable() { 11 factory _StringBase._uninstantiable() {
12 throw new UnsupportedError( 12 throw new UnsupportedError(
13 "_StringBase can't be instaniated"); 13 "_StringBase can't be instaniated");
14 } 14 }
15 15
16 int get hashCode native "String_getHashCode"; 16 int get hashCode native "String_getHashCode";
17 17
18 /** 18 /**
19 * Create the most efficient string representation for specified 19 * Create the most efficient string representation for specified
20 * [codePoints]. 20 * [codePoints].
21 */ 21 */
22 static String createFromCharCodes(Iterable<int> charCodes) { 22 static String createFromCharCodes(Iterable<int> charCodes) {
23 if (charCodes is! _ObjectArray) { 23 if (charCodes is! _ObjectArray && charCodes is! _GrowableObjectArray) {
24 charCodes = new List<int>.from(charCodes, growable: false); 24 charCodes = new List<int>.from(charCodes, growable: false);
25 } 25 }
26 return _createFromCodePoints(charCodes); 26 return _createFromCodePoints(charCodes);
27 } 27 }
28 28
29 static String _createFromCodePoints(List<int> codePoints) 29 static String _createFromCodePoints(List<int> codePoints)
30 native "StringBase_createFromCodePoints"; 30 native "StringBase_createFromCodePoints";
31 31
32 String operator [](int index) native "String_charAt"; 32 String operator [](int index) native "String_charAt";
33 33
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 for (int g in groups) { 599 for (int g in groups) {
600 result.add(group(g)); 600 result.add(group(g));
601 } 601 }
602 return result; 602 return result;
603 } 603 }
604 604
605 final int start; 605 final int start;
606 final String str; 606 final String str;
607 final String pattern; 607 final String pattern;
608 } 608 }
OLDNEW
« no previous file with comments | « runtime/lib/string.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698