Skip to content

Commit

Permalink
fix corner case in inline (#5760)
Browse files Browse the repository at this point in the history
fixes #5759
  • Loading branch information
alexlamsl authored Dec 7, 2022
1 parent 17c3ae6 commit dd88f38
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/compress.js
Original file line number Diff line number Diff line change
Expand Up @@ -14076,6 +14076,7 @@ Compressor.prototype.compress = function(node) {
var sym = def.orig[0];
if (sym instanceof AST_SymbolCatch) return;
body.push(make_node(AST_SimpleStatement, sym, { body: init_ref(compressor, flatten_var(sym)) }));
def.first_decl = null;
});
var defs = Object.create(null), syms = new Dictionary();
if (simple_argnames && all(call.args, function(arg) {
Expand Down
44 changes: 44 additions & 0 deletions test/compress/let.js
Original file line number Diff line number Diff line change
Expand Up @@ -2493,3 +2493,47 @@ issue_5756_3: {
expect_stdout: "PASS"
node_version: ">=4"
}

issue_5759: {
options = {
collapse_vars: true,
inline: true,
join_vars: true,
reduce_vars: true,
unused: true,
}
input: {
"use strict";
function f() {
for (var a in [ true ]) {
let b;
(function() {
var c = void 0;
b;
console.log(c);
var d = null;
console.log(c);
})();
}
}
f();
}
expect: {
"use strict";
function f() {
for (var a in [ true ]) {
let b;
var c = c = void 0;
b;
console.log(c);
console.log(c);
}
}
f();
}
expect_stdout: [
"undefined",
"undefined",
]
node_version: ">=4"
}

0 comments on commit dd88f38

Please sign in to comment.