[Pkg-javascript-commits] [uglifyjs] 56/190: Have mozilla AST RegExpLiteral parser use regex.pattern and regex.flags rather than non-standard `raw` property.
Antonio Terceiro
terceiro at moszumanska.debian.org
Sun Aug 7 23:17:12 UTC 2016
This is an automated email from the git hooks/post-receive script.
terceiro pushed a commit to annotated tag upstream/2.7.0
in repository uglifyjs.
commit 94c4daaf9ea67875ab1b720d1d7bceef7c690552
Author: kzc <zaxxon2011 at gmail.com>
Date: Mon Nov 2 12:24:09 2015 -0500
Have mozilla AST RegExpLiteral parser use regex.pattern and regex.flags rather than non-standard `raw` property.
---
lib/mozilla-ast.js | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/lib/mozilla-ast.js b/lib/mozilla-ast.js
index 15be458..7ce6e78 100644
--- a/lib/mozilla-ast.js
+++ b/lib/mozilla-ast.js
@@ -146,7 +146,17 @@
case "boolean":
return new (val ? AST_True : AST_False)(args);
default:
- args.value = M.regex && M.raw ? M.raw : val;
+ 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;
+ }
+ } else {
+ // support legacy RegExp
+ args.value = M.regex && M.raw ? M.raw : val;
+ }
return new AST_RegExp(args);
}
},
@@ -334,7 +344,7 @@
};
});
- def_to_moz(AST_RegExp, function To_Moz_RegExp(M) {
+ def_to_moz(AST_RegExp, function To_Moz_RegExpLiteral(M) {
var value = M.value;
return {
type: "Literal",
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git
More information about the Pkg-javascript-commits
mailing list