| Index: sdk/lib/_internal/compiler/implementation/lib/js_string.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/lib/js_string.dart b/sdk/lib/_internal/compiler/implementation/lib/js_string.dart
|
| index 92d7c673a2a62bc8da0b152e3afa0a81c59d5bdb..6b083719d95f65f10cc0e1cc99244e57f19fa121 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/lib/js_string.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/lib/js_string.dart
|
| @@ -25,6 +25,20 @@ class JSString extends Interceptor implements String, JSIndexable {
|
| return allMatchesInStringUnchecked(this, str);
|
| }
|
|
|
| + Match matchAsPrefix(String string, [int start = 0]) {
|
| + if (start < 0 || start > string.length) {
|
| + throw new RangeError.range(start, 0, string.length);
|
| + }
|
| + if (start + this.length > string.length) return null;
|
| + // TODO(lrn): See if this can be optimized.
|
| + for (int i = 0; i < this.length; i++) {
|
| + if (string.codeUnitAt(start + i) != this.codeUnitAt(i)) {
|
| + return null;
|
| + }
|
| + }
|
| + return new StringMatch(start, string, this);
|
| + }
|
| +
|
| String operator +(String other) {
|
| if (other is !String) throw new ArgumentError(other);
|
| return JS('String', r'# + #', this, other);
|
|
|