Skip to content

Commit dd88f38

Browse files
authored
fix corner case in inline (#5760)
fixes #5759
1 parent 17c3ae6 commit dd88f38

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

lib/compress.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14076,6 +14076,7 @@ Compressor.prototype.compress = function(node) {
1407614076
var sym = def.orig[0];
1407714077
if (sym instanceof AST_SymbolCatch) return;
1407814078
body.push(make_node(AST_SimpleStatement, sym, { body: init_ref(compressor, flatten_var(sym)) }));
14079+
def.first_decl = null;
1407914080
});
1408014081
var defs = Object.create(null), syms = new Dictionary();
1408114082
if (simple_argnames && all(call.args, function(arg) {

test/compress/let.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2493,3 +2493,47 @@ issue_5756_3: {
24932493
expect_stdout: "PASS"
24942494
node_version: ">=4"
24952495
}
2496+
2497+
issue_5759: {
2498+
options = {
2499+
collapse_vars: true,
2500+
inline: true,
2501+
join_vars: true,
2502+
reduce_vars: true,
2503+
unused: true,
2504+
}
2505+
input: {
2506+
"use strict";
2507+
function f() {
2508+
for (var a in [ true ]) {
2509+
let b;
2510+
(function() {
2511+
var c = void 0;
2512+
b;
2513+
console.log(c);
2514+
var d = null;
2515+
console.log(c);
2516+
})();
2517+
}
2518+
}
2519+
f();
2520+
}
2521+
expect: {
2522+
"use strict";
2523+
function f() {
2524+
for (var a in [ true ]) {
2525+
let b;
2526+
var c = c = void 0;
2527+
b;
2528+
console.log(c);
2529+
console.log(c);
2530+
}
2531+
}
2532+
f();
2533+
}
2534+
expect_stdout: [
2535+
"undefined",
2536+
"undefined",
2537+
]
2538+
node_version: ">=4"
2539+
}

0 commit comments

Comments
 (0)