| Index: sdk/lib/_internal/compiler/js_lib/string_helper.dart
|
| diff --git a/sdk/lib/_internal/compiler/js_lib/string_helper.dart b/sdk/lib/_internal/compiler/js_lib/string_helper.dart
|
| index 77b8ab9c34a95b95cb4c4c44604578362ffed8ee..ff2505729a1b3cce8352be876681941925776479 100644
|
| --- a/sdk/lib/_internal/compiler/js_lib/string_helper.dart
|
| +++ b/sdk/lib/_internal/compiler/js_lib/string_helper.dart
|
| @@ -193,34 +193,21 @@ stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onNonMatch) {
|
| }
|
|
|
|
|
| -stringReplaceFirstUnchecked(receiver, from, to, int startIndex) {
|
| +stringReplaceFirstUnchecked(receiver, from, to, [int startIndex = 0]) {
|
| if (from is String) {
|
| - int index = receiver.indexOf(from, startIndex);
|
| + var index = receiver.indexOf(from, startIndex);
|
| if (index < 0) return receiver;
|
| return '${receiver.substring(0, index)}$to'
|
| '${receiver.substring(index + from.length)}';
|
| - }
|
| - if (from is JSSyntaxRegExp) {
|
| + } else if (from is JSSyntaxRegExp) {
|
| return startIndex == 0 ?
|
| stringReplaceJS(receiver, regExpGetNative(from), to) :
|
| stringReplaceFirstRE(receiver, from, to, startIndex);
|
| + } else {
|
| + checkNull(from);
|
| + // TODO(floitsch): implement generic String.replace (with patterns).
|
| + throw "String.replace(Pattern) UNIMPLEMENTED";
|
| }
|
| - checkNull(from);
|
| - Iterator<Match> matches = from.allMatches(receiver, startIndex).iterator;
|
| - if (!matches.moveNext()) return receiver;
|
| - Match match = matches.current;
|
| - return '${receiver.substring(0, match.start)}$to'
|
| - '${receiver.substring(match.end)}';
|
| -}
|
| -
|
| -stringReplaceFirstMappedUnchecked(receiver, from, replace,
|
| - int startIndex) {
|
| - Iterator<Match> matches = from.allMatches(receiver, startIndex).iterator;
|
| - if (!matches.moveNext()) return receiver;
|
| - Match match = matches.current;
|
| - String replacement = "${replace(match)}";
|
| - return '${receiver.substring(0, match.start)}$replacement'
|
| - '${receiver.substring(match.end)}';
|
| }
|
|
|
| stringJoinUnchecked(array, separator) {
|
|
|