Index: sdk/lib/_internal/js_runtime/lib/regexp_helper.dart |
diff --git a/sdk/lib/_internal/js_runtime/lib/regexp_helper.dart b/sdk/lib/_internal/js_runtime/lib/regexp_helper.dart |
index 9b44116c08cb9de956679643545747993d6e6b04..35a42d1ce00240ac3f2c7fc89e91651b4944e520 100644 |
--- a/sdk/lib/_internal/js_runtime/lib/regexp_helper.dart |
+++ b/sdk/lib/_internal/js_runtime/lib/regexp_helper.dart |
@@ -85,23 +85,24 @@ class JSSyntaxRegExp implements RegExp { |
String m = multiLine == true ? 'm' : ''; |
String i = caseSensitive == true ? '' : 'i'; |
String g = global ? 'g' : ''; |
- // We're using the JavaScript's try catch instead of the Dart one |
- // to avoid dragging in Dart runtime support just because of using |
- // RegExp. |
+ // We're using the JavaScript's try catch instead of the Dart one to avoid |
+ // dragging in Dart runtime support just because of using RegExp. |
var regexp = JS('', |
- '(function() {' |
- 'try {' |
- 'return new RegExp(#, # + # + #);' |
- '} catch (e) {' |
- 'return e;' |
- '}' |
- '})()', source, m, i, g); |
+ r''' |
+ (function(source, modifiers) { |
+ try { |
+ return new RegExp(source, modifiers); |
+ } catch (e) { |
+ return e; |
+ } |
+ })(#, # + # + #)''', |
+ source, m, i, g); |
if (JS('bool', '# instanceof RegExp', regexp)) return regexp; |
// The returned value is the JavaScript exception. Turn it into a |
// Dart exception. |
String errorMessage = JS('String', r'String(#)', regexp); |
throw new FormatException( |
- "Illegal RegExp pattern ($errorMessage)", source); |
+ 'Illegal RegExp pattern ($errorMessage)', source); |
} |
Match firstMatch(String string) { |