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