Index: runtime/lib/regexp_patch.dart |
diff --git a/runtime/lib/regexp_patch.dart b/runtime/lib/regexp_patch.dart |
index 115dd45a802e922de1651dd4976fae123d4f850a..b5f75d544580b352f28a8dfeed73aa1df5a76e20 100644 |
--- a/runtime/lib/regexp_patch.dart |
+++ b/runtime/lib/regexp_patch.dart |
@@ -2,6 +2,16 @@ |
// 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}) { |
+ return new _JSSyntaxRegExp(pattern, |
+ multiLine: multiLine, |
+ ignoreCase: ignoreCase); |
+ } |
+} |
+ |
class _JSRegExpMatch implements Match { |
_JSRegExpMatch(this.regexp, this.str, this._match); |
@@ -53,13 +63,13 @@ class _JSRegExpMatch implements Match { |
} |
-patch class JSSyntaxRegExp { |
- /* patch */ const factory JSSyntaxRegExp( |
+class _JSSyntaxRegExp extends RegExp { |
floitsch
2012/11/12 16:31:56
why not just "implements"?
Anders Johnsen
2012/11/12 16:58:38
Done.
|
+ 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 +77,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 +99,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 +113,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"; |