Skip to content

Commit

Permalink
fix corner case in hoist_props (#4986)
Browse files Browse the repository at this point in the history
fixes #4985
  • Loading branch information
alexlamsl committed May 30, 2021
1 parent 7e88d52 commit 23b9f36
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/compress.js
Expand Up @@ -7432,7 +7432,8 @@ merge(Compressor.prototype, {
&& all(right.properties, can_hoist_property)
&& all(def.references, function(ref) {
return ref.fixed_value() === right;
});
})
&& can_drop_symbol(sym, compressor);
}
});

Expand Down
24 changes: 24 additions & 0 deletions test/compress/let.js
Expand Up @@ -1580,3 +1580,27 @@ issue_4848: {
expect_stdout: "PASS"
node_version: ">=4"
}

issue_4985: {
options = {
hoist_props: true,
reduce_vars: true,
toplevel: true,
}
input: {
"use strict";
let a = { p: 42 };
console.log(function() {
a;
}());
}
expect: {
"use strict";
let a = { p: 42 };
console.log(function() {
a;
}());
}
expect_stdout: "undefined"
node_version: ">=4"
}

0 comments on commit 23b9f36

Please sign in to comment.