Index: runtime/lib/regexp_patch.dart |
diff --git a/runtime/lib/regexp_patch.dart b/runtime/lib/regexp_patch.dart |
index 115dd45a802e922de1651dd4976fae123d4f850a..4b1c9a01df40b31ba94e8a95b2a6257f80e24377 100644 |
--- a/runtime/lib/regexp_patch.dart |
+++ b/runtime/lib/regexp_patch.dart |
@@ -2,6 +2,15 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
+patch class RegExp { |
+ /* patch */ factory RegExp(String pattern, |
+ {bool multiLine: false, |
+ bool ignoreCase: false}) |
+ => new _JSSyntaxRegExp(pattern, |
Mads Ager (google)
2012/11/12 12:28:10
I don't like the arrow when the body takes up this
Anders Johnsen
2012/11/12 12:30:32
Sure, done!
|
+ multiLine: multiLine, |
+ ignoreCase: ignoreCase); |
+} |
+ |
class _JSRegExpMatch implements Match { |
_JSRegExpMatch(this.regexp, this.str, this._match); |
@@ -53,13 +62,13 @@ class _JSRegExpMatch implements Match { |
} |
-patch class JSSyntaxRegExp { |
- /* patch */ const factory JSSyntaxRegExp( |
+class _JSSyntaxRegExp extends RegExp { |
+ factory _JSSyntaxRegExp( |
String pattern, |
{bool multiLine: false, |
bool ignoreCase: false}) native "JSSyntaxRegExp_factory"; |
- /* patch */ Match firstMatch(String str) { |
+ Match firstMatch(String str) { |
List match = _ExecuteMatch(str, 0); |
if (match === null) { |
return null; |
@@ -67,7 +76,7 @@ patch class JSSyntaxRegExp { |
return new _JSRegExpMatch(this, str, match); |
} |
- /* patch */ Iterable<Match> allMatches(String str) { |
+ Iterable<Match> allMatches(String str) { |
List<Match> result = new List<Match>(); |
int length = str.length; |
int startIndex = 0; |
@@ -89,12 +98,12 @@ patch class JSSyntaxRegExp { |
return result; |
} |
- /* patch */ bool hasMatch(String str) { |
+ bool hasMatch(String str) { |
List match = _ExecuteMatch(str, 0); |
return (match === null) ? false : true; |
} |
- /* patch */ String stringMatch(String str) { |
+ String stringMatch(String str) { |
List match = _ExecuteMatch(str, 0); |
if (match === null) { |
return null; |
@@ -103,11 +112,11 @@ patch class JSSyntaxRegExp { |
return str.substring(match[0], match[1]); |
} |
- /* patch */ String get pattern native "JSSyntaxRegExp_getPattern"; |
+ String get pattern native "JSSyntaxRegExp_getPattern"; |
- /* patch */ bool get multiLine native "JSSyntaxRegExp_multiLine"; |
+ bool get multiLine native "JSSyntaxRegExp_multiLine"; |
- /* patch */ bool get ignoreCase native "JSSyntaxRegExp_ignoreCase"; |
+ bool get ignoreCase native "JSSyntaxRegExp_ignoreCase"; |
int get _groupCount native "JSSyntaxRegExp_getGroupCount"; |