aboutsummaryrefslogtreecommitdiff
path: root/lib/scope.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-04-08 02:29:37 +0800
committerGitHub <noreply@github.com>2018-04-08 02:29:37 +0800
commite5f6a882333cf0dcaf87e2a58dfa2867106114e9 (patch)
treed7f363e28803d2056a3284fd983cf5ecca06aa8e /lib/scope.js
parent8d0b00317e7f4ca63c806c2a6049bbbc804012d2 (diff)
downloadtracifyjs-e5f6a882333cf0dcaf87e2a58dfa2867106114e9.tar.gz
tracifyjs-e5f6a882333cf0dcaf87e2a58dfa2867106114e9.zip
fix corner case in reuse of `mangle` options (#3062)
Diffstat (limited to 'lib/scope.js')
-rw-r--r--lib/scope.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/scope.js b/lib/scope.js
index 2c325f68..c3a77746 100644
--- a/lib/scope.js
+++ b/lib/scope.js
@@ -344,7 +344,7 @@ function next_mangled_name(scope, options, def) {
}
while (true) {
name = base54(++scope.cname);
- if (in_use[name] || !is_identifier(name) || options._reserved[name]) continue;
+ if (in_use[name] || !is_identifier(name) || options.reserved.has[name]) continue;
if (!names[name]) break;
holes.push(scope.cname);
}
@@ -387,7 +387,7 @@ function _default_mangler_options(options) {
if (!Array.isArray(options.reserved)) options.reserved = [];
// Never mangle arguments
push_uniq(options.reserved, "arguments");
- options._reserved = makePredicate(options.reserved);
+ options.reserved.has = makePredicate(options.reserved);
return options;
}
@@ -453,7 +453,7 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options){
redefined.forEach(mangle);
function mangle(def) {
- if (options._reserved[def.name]) return;
+ if (options.reserved.has[def.name]) return;
def.mangle(options);
}
});
@@ -504,7 +504,7 @@ AST_Toplevel.DEFMETHOD("expand_names", function(options) {
function rename(def) {
if (def.global && options.cache) return;
if (def.unmangleable(options)) return;
- if (options._reserved[def.name]) return;
+ if (options.reserved.has[def.name]) return;
var d = def.redefined();
def.name = d ? d.name : next_name();
def.orig.forEach(function(sym) {