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

Unified Diff: sdk/lib/_internal/lib/js_string.dart

Issue 460613002: Add optional start index to Pattern.allMatches. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add extra test. Created 6 years, 4 months 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/lib/js_string.dart
diff --git a/sdk/lib/_internal/lib/js_string.dart b/sdk/lib/_internal/lib/js_string.dart
index 36372f46c9caee94754fe3ae48935c9a4d676443..a6962cb2432eb24af6e5a6f614d75bbdd3014bc9 100644
--- a/sdk/lib/_internal/lib/js_string.dart
+++ b/sdk/lib/_internal/lib/js_string.dart
@@ -20,9 +20,13 @@ class JSString extends Interceptor implements String, JSIndexable {
return JS('JSUInt31', r'#.charCodeAt(#)', this, index);
}
- Iterable<Match> allMatches(String str) {
- checkString(str);
- return allMatchesInStringUnchecked(this, str);
+ Iterable<Match> allMatches(String string, [int start = 0]) {
+ checkString(string);
+ checkInt(start);
+ if (0 > start || start > string.length) {
+ throw new RangeError.range(start, 0, string.length);
+ }
+ return allMatchesInStringUnchecked(this, string, start);
}
Match matchAsPrefix(String string, [int start = 0]) {

Powered by Google App Engine
This is Rietveld 408576698