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

Unified Diff: lib/compiler/implementation/lib/core_patch.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
« no previous file with comments | « no previous file | lib/compiler/implementation/lib/coreimpl_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/lib/core_patch.dart
diff --git a/lib/compiler/implementation/lib/core_patch.dart b/lib/compiler/implementation/lib/core_patch.dart
index 31c94d74510e86b72be3baa6b33d59b46199bea1..58536c74e91f5035f85e164e113d8ed82247542c 100644
--- a/lib/compiler/implementation/lib/core_patch.dart
+++ b/lib/compiler/implementation/lib/core_patch.dart
@@ -162,3 +162,50 @@ patch class _ListImpl<E> {
return result;
}
}
+
+
+// Patch for String implementation.
+patch class _StringImpl {
+ patch factory String.fromCharCodes(List<int> charCodes) {
+ checkNull(charCodes);
+ if (!isJsArray(charCodes)) {
+ if (charCodes is !List) throw new ArgumentError(charCodes);
+ charCodes = new List.from(charCodes);
+ }
+ return Primitives.stringFromCharCodes(charCodes);
+ }
+
+ patch String join(List<String> strings, String separator) {
floitsch 2012/10/30 13:53:05 should be static.
Anders Johnsen 2012/10/30 14:19:31 Done.
+ checkNull(strings);
+ checkNull(separator);
+ if (separator is !String) throw new ArgumentError(separator);
+ return stringJoinUnchecked(_toJsStringArray(strings), separator);
+ }
+
+ patch String concatAll(List<String> strings) {
floitsch 2012/10/30 13:53:05 should be static.
Anders Johnsen 2012/10/30 14:19:31 Done.
+ return stringJoinUnchecked(_toJsStringArray(strings), "");
+ }
+
+ static List _toJsStringArray(List<String> strings) {
+ checkNull(strings);
+ var array;
+ final length = strings.length;
+ if (isJsArray(strings)) {
+ array = strings;
+ for (int i = 0; i < length; i++) {
+ final string = strings[i];
+ checkNull(string);
+ if (string is !String) throw new ArgumentError(string);
+ }
+ } else {
+ array = new List(length);
+ for (int i = 0; i < length; i++) {
+ final string = strings[i];
+ checkNull(string);
+ if (string is !String) throw new ArgumentError(string);
+ array[i] = string;
+ }
+ }
+ return array;
+ }
+}
« no previous file with comments | « no previous file | lib/compiler/implementation/lib/coreimpl_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698