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

Unified Diff: sdk/lib/_internal/js_runtime/lib/string_helper.dart

Issue 2545153002: Handle synthetic nodes use to throw exceptions (Closed)
Patch Set: Also handle malformed type Created 4 years 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: sdk/lib/_internal/js_runtime/lib/string_helper.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/string_helper.dart b/sdk/lib/_internal/js_runtime/lib/string_helper.dart
index 24e21f7fbd02c88baee8badfbe3d56838a5863fc..8ec6c479974d43341439103b8a7cc1f21e16484c 100644
--- a/sdk/lib/_internal/js_runtime/lib/string_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/string_helper.dart
@@ -144,7 +144,7 @@ stringReplaceAllUnchecked(receiver, pattern, replacement) {
if (receiver == "") {
return replacement;
} else {
- StringBuffer result = new StringBuffer();
+ StringBuffer result = new StringBuffer('');
int length = receiver.length;
result.write(replacement);
for (int i = 0; i < length; i++) {
@@ -184,7 +184,7 @@ stringReplaceAllFuncUnchecked(receiver, pattern, onMatch, onNonMatch) {
if (pattern is! Pattern) {
throw new ArgumentError.value(pattern, 'pattern', 'is not a Pattern');
}
- StringBuffer buffer = new StringBuffer();
+ StringBuffer buffer = new StringBuffer('');
int startIndex = 0;
for (Match match in pattern.allMatches(receiver)) {
buffer.write(onNonMatch(receiver.substring(startIndex, match.start)));
@@ -197,7 +197,7 @@ stringReplaceAllFuncUnchecked(receiver, pattern, onMatch, onNonMatch) {
stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch) {
// Pattern is the empty string.
- StringBuffer buffer = new StringBuffer();
+ StringBuffer buffer = new StringBuffer('');
int length = receiver.length;
int i = 0;
buffer.write(onNonMatch(""));
@@ -229,7 +229,7 @@ stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onNonMatch) {
return stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch);
}
int length = receiver.length;
- StringBuffer buffer = new StringBuffer();
+ StringBuffer buffer = new StringBuffer('');
int startIndex = 0;
while (startIndex < length) {
int position = stringIndexOfStringUnchecked(receiver, pattern, startIndex);

Powered by Google App Engine
This is Rietveld 408576698