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

Unified Diff: dart/frog/leg/lib/regexp_helper.dart

Issue 9426040: Improve String and RegExp implementations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: changes Created 8 years, 10 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: dart/frog/leg/lib/regexp_helper.dart
diff --git a/dart/frog/leg/lib/regexp_helper.dart b/dart/frog/leg/lib/regexp_helper.dart
index 32fae10e31d655d23a8bb644efdd82669d7773b6..5cdd9d9f0e613e2ba17bb7155ab8ed63edd36899 100644
--- a/dart/frog/leg/lib/regexp_helper.dart
+++ b/dart/frog/leg/lib/regexp_helper.dart
@@ -14,15 +14,19 @@ class RegExpWrapper {
ignoreCase == true ? 'i' : ''}${
global == true ? 'g' : ''}");
+ RegExpWrapper.fromRegExp(other, global)
+ // TODO(ahe): Use redirection.
ngeoffray 2012/02/21 12:15:53 Should be supported now.
+ : re = makeRegExp(other.pattern, "${other.multiLine == true ? 'm' : ''}${
+ other.ignoreCase == true ? 'i' : ''}${
+ global == true ? 'g' : ''}");
+
exec(str) {
var result = JS('List', @'$0.exec($1)', re, checkString(str));
if (JS('bool', @'$0 === null', result)) return null;
return result;
}
- lastIndex() => JS('List', @'$0.lastIndex', re);
-
- test(str) => JS('List', @'$0.test($1)', re, checkString(str));
+ test(str) => JS('bool', @'$0.test($1)', re, checkString(str));
static matchStart(m) => JS('int', @'$0.index', m);
@@ -36,3 +40,5 @@ class RegExpWrapper {
}
}
}
+
+stringify(x) => x === null ? "" : x.toString();

Powered by Google App Engine
This is Rietveld 408576698