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

Unified Diff: tool/input_sdk/patch/core_patch.dart

Issue 1957633002: Upgrade StringBuffer, identical (Closed) Base URL: https://github.com/dart-lang/dev_compiler@master
Patch Set: Created 4 years, 7 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 | « tool/input_sdk/lib/core/string_buffer.dart ('k') | tool/input_sdk/private/js_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tool/input_sdk/patch/core_patch.dart
diff --git a/tool/input_sdk/patch/core_patch.dart b/tool/input_sdk/patch/core_patch.dart
index da771fe5ac93784d8bcfd27193fd893af0e7cb1e..e3f51f51302051fd5b76cce87167b8d043e75387 100644
--- a/tool/input_sdk/patch/core_patch.dart
+++ b/tool/input_sdk/patch/core_patch.dart
@@ -375,7 +375,7 @@ class RegExp {
// Patch for 'identical' function.
@patch
bool identical(Object a, Object b) {
- return Primitives.identicalImplementation(a, b);
+ return JS('bool', '(# == null ? # == null : # === #)', a, b, a, b);
}
@patch
@@ -398,8 +398,14 @@ class StringBuffer {
_writeString(new String.fromCharCode(charCode));
}
- void _writeString(str) {
- _contents = Primitives.stringConcatUnchecked(_contents, str);
+ @patch
+ void writeAll(Iterable objects, [String separator = ""]) {
+ _contents = _writeAll(_contents, objects, separator);
+ }
+
+ @patch
+ void writeln([Object obj = ""]) {
+ _writeString('$obj\n');
}
@patch
@@ -409,6 +415,31 @@ class StringBuffer {
@patch
String toString() => Primitives.flattenString(_contents);
+
+ void _writeString(str) {
+ _contents = Primitives.stringConcatUnchecked(_contents, str);
+ }
+
+ static String _writeAll(String string, Iterable objects, String separator) {
+ Iterator iterator = objects.iterator;
+ if (!iterator.moveNext()) return string;
+ if (separator.isEmpty) {
+ do {
+ string = _writeOne(string, iterator.current);
+ } while (iterator.moveNext());
+ } else {
+ string = _writeOne(string, iterator.current);
+ while (iterator.moveNext()) {
+ string = _writeOne(string, separator);
+ string = _writeOne(string, iterator.current);
+ }
+ }
+ return string;
+ }
+
+ static String _writeOne(String string, Object obj) {
+ return Primitives.stringConcatUnchecked(string, '$obj');
+ }
}
@patch
« no previous file with comments | « tool/input_sdk/lib/core/string_buffer.dart ('k') | tool/input_sdk/private/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698