Bug report
Version
Complete CLI command
terser --compress -- input.js
terser input
function main(e) {
console.log(e.length);
let other = "12";
for (let e; e = 0;) {
console.log(e);
}
}
main("foo");
terser output
function main(e){console.log(e.length);let e;for(;e=0;)console.log(e)}main("foo");
When executed, the code throws SyntaxError: Identifier 'e' has already been declared.
The let declaration hoisted from inside the for loop causes a name conflict with the function parameter.
Expected result
I would expect the let declaration to stay inside the loop, even if there is a previous let declaration outside of the loop
Other notes
I can work around the issue by disabling join_vars compress option.
Bug report
Version
Complete CLI command
terserinputterseroutputWhen executed, the code throws
SyntaxError: Identifier 'e' has already been declared.The
letdeclaration hoisted from inside theforloop causes a name conflict with the function parameter.Expected result
I would expect the
letdeclaration to stay inside the loop, even if there is a previousletdeclaration outside of the loopOther notes
I can work around the issue by disabling
join_varscompress option.