Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes mishoo/UglifyJS/issues/363 #364

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ function Scope(parent) {
this.uses_eval = false; // will become TRUE if eval() is detected in this or any subscopes
this.parent = parent; // parent scope
this.children = []; // sub-scopes
this.except = null; // except list
if (parent) {
this.except = parent.except;
this.level = parent.level + 1;
parent.children.push(this);
} else {
Expand Down Expand Up @@ -334,6 +336,9 @@ Scope.prototype = {
//
// 3. doesn't shadow a name that is referenced but not
// defined (possibly global defined elsewhere).
//
// 4. is not in the reserved names list
//
for (;;) {
var m = base54(++this.cname), prior;

Expand All @@ -351,6 +356,10 @@ Scope.prototype = {
if (HOP(this.refs, m) && this.refs[m] == null)
continue;

// case 4
if (this.except && member(m, this.except))
continue;

// I got "do" once. :-/
if (!is_identifier(m))
continue;
Expand Down Expand Up @@ -545,6 +554,7 @@ function ast_mangle(ast, options) {
function with_scope(s, cont, extra) {
var _scope = scope;
scope = s;
scope.except = options.except;
if (extra) for (var i in extra) if (HOP(extra, i)) {
s.set_mangle(i, extra[i]);
}
Expand Down