Describe the bug
In the below code, both selected and getArray are renamed to i. However, the variable scoping is incorrect - the selected in deselect conflicts with the declaration of getArray.
To Reproduce
(function (Bar) {
function getArray() {
return [];
}
let domElement = null;
function initialise(input) {
if (domElement === null || input.length === 0) {
return;
}
let selected = -1;
function deselect() {
selected = -1;
}
domElement.on("input focus", (() => {
domElement.val() === "" ? (selected = -1) : deselect();
}));
}
Bar.initialise = () => initialise(getArray());
})(Foo.Bar);
This file is run as:
var input = File.ReadAllText("input.js");
var output = Uglify.Js(input).Code;
Minified output (after formatting)
(function (n) {
function i() {
return []
}
function r(n) {
function r() {
i = -1
}
if (t !== null && n.length !== 0) {
let i = -1;
t.on("input focus", () => {
t.val() === "" ? i = -1 : r()
})
}
}
let t = null;
n.initialise = () => r(i())
})(Foo.Bar)
Describe the bug In the below code, both
selected
andgetArray
are renamed toi
. However, the variable scoping is incorrect - theselected
indeselect
conflicts with the declaration ofgetArray
.To Reproduce
This file is run as:
Minified output (after formatting)