aboutsummaryrefslogtreecommitdiff
path: root/lib/mozilla-ast.js
diff options
context:
space:
mode:
authorkzc <zaxxon2011@gmail.com>2015-11-02 13:10:37 -0500
committerkzc <zaxxon2011@gmail.com>2015-11-02 13:10:37 -0500
commit7dbe961b2d49533d54dfe5263f94de27de043316 (patch)
tree2c4e1fe090d881b9c3e78eefb44c659ba6ab6342 /lib/mozilla-ast.js
parent94c4daaf9ea67875ab1b720d1d7bceef7c690552 (diff)
downloadtracifyjs-7dbe961b2d49533d54dfe5263f94de27de043316.tar.gz
tracifyjs-7dbe961b2d49533d54dfe5263f94de27de043316.zip
simplify mozilla AST RegExpLiteral token parse and handle corner cases of regex.pattern better
Diffstat (limited to 'lib/mozilla-ast.js')
-rw-r--r--lib/mozilla-ast.js5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/mozilla-ast.js b/lib/mozilla-ast.js
index 7ce6e78d..2bb469fb 100644
--- a/lib/mozilla-ast.js
+++ b/lib/mozilla-ast.js
@@ -149,10 +149,7 @@
var rx = M.regex;
if (rx && rx.pattern) {
// RegExpLiteral as per ESTree AST spec
- args.value = "/" + rx.pattern + "/";
- if (rx.flags) {
- args.value += rx.flags;
- }
+ args.value = new RegExp(rx.pattern, rx.flags).toString();
} else {
// support legacy RegExp
args.value = M.regex && M.raw ? M.raw : val;