| Index: sdk/lib/_internal/js_runtime/lib/js_string.dart
|
| diff --git a/sdk/lib/_internal/js_runtime/lib/js_string.dart b/sdk/lib/_internal/js_runtime/lib/js_string.dart
|
| index 86e2937dc0b4041c7930c1586bbfcc64bdf51299..b149c2328af7f306f56a7c66ac56c0c12274dcd6 100644
|
| --- a/sdk/lib/_internal/js_runtime/lib/js_string.dart
|
| +++ b/sdk/lib/_internal/js_runtime/lib/js_string.dart
|
| @@ -15,7 +15,7 @@ class JSString extends Interceptor implements String, JSIndexable {
|
|
|
| @NoInline()
|
| int codeUnitAt(int index) {
|
| - if (index is !int) throw diagnoseIndexError(this, index);
|
| + if (index is! int) throw diagnoseIndexError(this, index);
|
| if (index < 0) throw diagnoseIndexError(this, index);
|
| return _codeUnitAt(index);
|
| }
|
| @@ -49,7 +49,7 @@ class JSString extends Interceptor implements String, JSIndexable {
|
| }
|
|
|
| String operator +(String other) {
|
| - if (other is !String) throw new ArgumentError.value(other);
|
| + if (other is! String) throw new ArgumentError.value(other);
|
| return JS('String', r'# + #', this, other);
|
| }
|
|
|
| @@ -70,8 +70,7 @@ class JSString extends Interceptor implements String, JSIndexable {
|
| }
|
|
|
| String splitMapJoin(Pattern from,
|
| - {String onMatch(Match match),
|
| - String onNonMatch(String nonMatch)}) {
|
| + {String onMatch(Match match), String onNonMatch(String nonMatch)}) {
|
| return stringReplaceAllFuncUnchecked(this, from, onMatch, onNonMatch);
|
| }
|
|
|
| @@ -83,7 +82,7 @@ class JSString extends Interceptor implements String, JSIndexable {
|
| }
|
|
|
| String replaceFirstMapped(Pattern from, String replace(Match match),
|
| - [int startIndex = 0]) {
|
| + [int startIndex = 0]) {
|
| checkNull(replace);
|
| checkInt(startIndex);
|
| RangeError.checkValueInInterval(startIndex, 0, this.length, "startIndex");
|
| @@ -157,21 +156,19 @@ class JSString extends Interceptor implements String, JSIndexable {
|
| checkInt(startIndex);
|
| if (endIndex == null) endIndex = length;
|
| checkInt(endIndex);
|
| - if (startIndex < 0 ) throw new RangeError.value(startIndex);
|
| + if (startIndex < 0) throw new RangeError.value(startIndex);
|
| if (startIndex > endIndex) throw new RangeError.value(startIndex);
|
| if (endIndex > length) throw new RangeError.value(endIndex);
|
| return JS('String', r'#.substring(#, #)', this, startIndex, endIndex);
|
| }
|
|
|
| String toLowerCase() {
|
| - return JS(
|
| - 'returns:String;effects:none;depends:none;throws:null(1)',
|
| + return JS('returns:String;effects:none;depends:none;throws:null(1)',
|
| r'#.toLowerCase()', this);
|
| }
|
|
|
| String toUpperCase() {
|
| - return JS(
|
| - 'returns:String;effects:none;depends:none;throws:null(1)',
|
| + return JS('returns:String;effects:none;depends:none;throws:null(1)',
|
| r'#.toUpperCase()', this);
|
| }
|
|
|
| @@ -350,8 +347,8 @@ class JSString extends Interceptor implements String, JSIndexable {
|
| return JS('String', r'#.substring(#, #)', result, 0, endIndex);
|
| }
|
|
|
| - String operator*(int times) {
|
| - if (0 >= times) return ''; // Unnecessary but hoists argument type check.
|
| + String operator *(int times) {
|
| + if (0 >= times) return ''; // Unnecessary but hoists argument type check.
|
| if (times == 1 || this.length == 0) return this;
|
| if (times != JS('JSUInt32', '# >>> 0', times)) {
|
| // times >= 2^32. We can't create a string that big.
|
| @@ -439,9 +436,8 @@ class JSString extends Interceptor implements String, JSIndexable {
|
| bool get isNotEmpty => !isEmpty;
|
|
|
| int compareTo(String other) {
|
| - if (other is !String) throw argumentErrorValue(other);
|
| - return this == other ? 0
|
| - : JS('bool', r'# < #', this, other) ? -1 : 1;
|
| + if (other is! String) throw argumentErrorValue(other);
|
| + return this == other ? 0 : JS('bool', r'# < #', this, other) ? -1 : 1;
|
| }
|
|
|
| // Note: if you change this, also change the function [S].
|
| @@ -462,7 +458,7 @@ class JSString extends Interceptor implements String, JSIndexable {
|
| hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
| hash = JS('int', '# ^ (# >> 6)', hash, hash);
|
| }
|
| - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
| + hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
| hash = JS('int', '# ^ (# >> 11)', hash, hash);
|
| return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
| }
|
| @@ -472,7 +468,7 @@ class JSString extends Interceptor implements String, JSIndexable {
|
| int get length => JS('int', r'#.length', this);
|
|
|
| String operator [](int index) {
|
| - if (index is !int) throw diagnoseIndexError(this, index);
|
| + if (index is! int) throw diagnoseIndexError(this, index);
|
| if (index >= length || index < 0) throw diagnoseIndexError(this, index);
|
| return JS('String', '#[#]', this, index);
|
| }
|
|
|