simplify mozilla AST RegExpLiteral token parse and handle corner cases of regex.pattern better
This commit is contained in:
parent
94c4daaf9e
commit
7dbe961b2d
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user