Index: pkg/dev_compiler/tool/input_sdk/private/regexp_helper.dart |
diff --git a/pkg/dev_compiler/tool/input_sdk/private/regexp_helper.dart b/pkg/dev_compiler/tool/input_sdk/private/regexp_helper.dart |
index efcea7c971a0d1f046cc863af4cd9b736eaa32ad..937a7ff1281429792dd6767854230e6d28cc6436 100644 |
--- a/pkg/dev_compiler/tool/input_sdk/private/regexp_helper.dart |
+++ b/pkg/dev_compiler/tool/input_sdk/private/regexp_helper.dart |
@@ -7,8 +7,6 @@ part of dart._js_helper; |
// Helper method used by internal libraries. |
regExpGetNative(JSSyntaxRegExp regexp) => regexp._nativeRegExp; |
-List<String> _stringList(List l) => l == null ? l : new JSArray<String>.of(l); |
- |
/** |
* Returns a native version of the RegExp with the global flag set. |
* |
@@ -36,7 +34,8 @@ regExpGetGlobalNative(JSSyntaxRegExp regexp) { |
*/ |
int regExpCaptureCount(JSSyntaxRegExp regexp) { |
var nativeAnchoredRegExp = regexp._nativeAnchoredVersion; |
- var match = JS('JSExtendableArray', "#.exec('')", nativeAnchoredRegExp); |
+ JSExtendableArray match = |
+ JS('JSExtendableArray', "#.exec('')", nativeAnchoredRegExp); |
// The native-anchored regexp always have one capture more than the original, |
// and always matches the empty string. |
return match.length - 2; |
@@ -76,9 +75,8 @@ class JSSyntaxRegExp implements RegExp { |
bool get _isMultiLine => JS("bool", "#.multiline", _nativeRegExp); |
bool get _isCaseSensitive => JS("bool", "!#.ignoreCase", _nativeRegExp); |
- static makeNative( |
- String source, bool multiLine, bool caseSensitive, bool global) { |
- checkString(source); |
+ static makeNative(@nullCheck String source, bool multiLine, |
+ bool caseSensitive, bool global) { |
String m = multiLine ? 'm' : ''; |
String i = caseSensitive ? '' : 'i'; |
String g = global ? 'g' : ''; |
@@ -105,15 +103,15 @@ class JSSyntaxRegExp implements RegExp { |
throw new FormatException("Illegal RegExp pattern: $source, $errorMessage"); |
} |
- Match firstMatch(String string) { |
- List m = JS('JSExtendableArray|Null', r'#.exec(#)', _nativeRegExp, |
- checkString(string)); |
+ Match firstMatch(@nullCheck String string) { |
+ List m = JS('JSExtendableArray|Null', r'#.exec(#)', _nativeRegExp, string); |
if (m == null) return null; |
- return new _MatchImplementation(this, _stringList(m)); |
+ return new _MatchImplementation(this, new JSArray<String>.of(m)); |
} |
- bool hasMatch(String string) { |
- return JS('bool', r'#.test(#)', _nativeRegExp, checkString(string)); |
+ @notNull |
+ bool hasMatch(@nullCheck String string) { |
+ return JS('bool', r'#.test(#)', _nativeRegExp, string); |
} |
String stringMatch(String string) { |
@@ -122,9 +120,8 @@ class JSSyntaxRegExp implements RegExp { |
return null; |
} |
- Iterable<Match> allMatches(String string, [int start = 0]) { |
- checkString(string); |
- checkInt(start); |
+ Iterable<Match> allMatches(@nullCheck String string, |
+ [@nullCheck int start = 0]) { |
if (start < 0 || start > string.length) { |
throw new RangeError.range(start, 0, string.length); |
} |
@@ -136,7 +133,7 @@ class JSSyntaxRegExp implements RegExp { |
JS("void", "#.lastIndex = #", regexp, start); |
List match = JS("JSExtendableArray|Null", "#.exec(#)", regexp, string); |
if (match == null) return null; |
- return new _MatchImplementation(this, _stringList(match)); |
+ return new _MatchImplementation(this, new JSArray<String>.of(match)); |
} |
Match _execAnchored(String string, int start) { |
@@ -148,7 +145,7 @@ class JSSyntaxRegExp implements RegExp { |
// match at the start position. |
if (match[match.length - 1] != null) return null; |
match.length -= 1; |
- return new _MatchImplementation(this, _stringList(match)); |
+ return new _MatchImplementation(this, new JSArray<String>.of(match)); |
} |
Match matchAsPrefix(String string, [int start = 0]) { |