aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-05-12 12:34:55 +0800
committerGitHub <noreply@github.com>2017-05-12 12:34:55 +0800
commitac73c5d4211b9ecff0f9650a032e964ef1cad585 (patch)
tree6c32e708e21369c61e3307686bb9d4e99aa03637 /lib
parent547f41beba43350970fdbe6a5a3793cb5b607847 (diff)
downloadtracifyjs-ac73c5d4211b9ecff0f9650a032e964ef1cad585.tar.gz
tracifyjs-ac73c5d4211b9ecff0f9650a032e964ef1cad585.zip
avoid `arguments` and `eval` in `reduce_vars` (#1924)
fixes #1922
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/compress.js b/lib/compress.js
index aff5c643..1ded032b 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -354,10 +354,14 @@ merge(Compressor.prototype, {
// So existing transformation rules can work on them.
node.argnames.forEach(function(arg, i) {
var d = arg.definition();
- d.fixed = function() {
- return iife.args[i] || make_node(AST_Undefined, iife);
- };
- mark(d, true);
+ if (!node.uses_arguments && d.fixed === undefined) {
+ d.fixed = function() {
+ return iife.args[i] || make_node(AST_Undefined, iife);
+ };
+ mark(d, true);
+ } else {
+ d.fixed = false;
+ }
});
}
descend();
@@ -491,7 +495,9 @@ merge(Compressor.prototype, {
function reset_def(def) {
def.escaped = false;
- if (!def.global || def.orig[0] instanceof AST_SymbolConst || compressor.toplevel(def)) {
+ if (def.scope.uses_eval) {
+ def.fixed = false;
+ } else if (!def.global || def.orig[0] instanceof AST_SymbolConst || compressor.toplevel(def)) {
def.fixed = undefined;
} else {
def.fixed = false;