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

Unified Diff: sdk/lib/_internal/compiler/implementation/lib/string_helper.dart

Issue 11312203: "Reverting 14829-14832" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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/compiler/implementation/lib/string_helper.dart
diff --git a/sdk/lib/_internal/compiler/implementation/lib/string_helper.dart b/sdk/lib/_internal/compiler/implementation/lib/string_helper.dart
index f70a975ac6666af26e3ff84154b97c9ec51140d8..3a35778c677a431b508c26c8ed97d583c9c8b487 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/string_helper.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/string_helper.dart
@@ -75,8 +75,6 @@ stringReplaceJS(receiver, replacer, to) {
return JS('String', r'#.replace(#, #)', receiver, replacer, to);
}
-final RegExp quoteRegExp = new JSSyntaxRegExp(r'[-[\]{}()*+?.,\\^$|#\s]');
-
stringReplaceAllUnchecked(receiver, from, to) {
if (from is String) {
if (from == "") {
@@ -93,6 +91,8 @@ stringReplaceAllUnchecked(receiver, from, to) {
return result.toString();
}
} else {
+ RegExp quoteRegExp =
+ const JSSyntaxRegExp(r'[-[\]{}()*+?.,\\^$|#\s]');
var quoter = regExpMakeNative(quoteRegExp, global: true);
var quoted = JS('String', r'#.replace(#, "\\$&")', from, quoter);
RegExp replaceRegExp = new JSSyntaxRegExp(quoted);

Powered by Google App Engine
This is Rietveld 408576698