Skip to content

Commit b9b2a4f

Browse files
authored
fix corner case in inline (#5311)
fixes #5222
1 parent b46c794 commit b9b2a4f

File tree

3 files changed

+34
-35
lines changed

3 files changed

+34
-35
lines changed

lib/compress.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8002,7 +8002,6 @@ Compressor.prototype.compress = function(node) {
80028002
var defs = defs_by_id[node.definition().id];
80038003
if (!defs) return;
80048004
if (node.fixed_value() !== defs.value) return;
8005-
if (is_lhs(node, this.parent())) return;
80068005
return make_node(AST_Object, node, { properties: [] });
80078006
}
80088007
}));

test/compress/default-values.js

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,40 +2005,6 @@ issue_5192: {
20052005
node_version: ">=6"
20062006
}
20072007

2008-
issue_5222: {
2009-
options = {
2010-
hoist_props: true,
2011-
inline: true,
2012-
reduce_vars: true,
2013-
side_effects: true,
2014-
toplevel: true,
2015-
unused: true,
2016-
}
2017-
input: {
2018-
function f() {
2019-
do {
2020-
(function() {
2021-
var a = {
2022-
p: [ a ] = [],
2023-
};
2024-
})();
2025-
} while (console.log("PASS"));
2026-
}
2027-
f();
2028-
}
2029-
expect: {
2030-
do {
2031-
a = void 0,
2032-
a = {
2033-
p: [ a ] = [],
2034-
};
2035-
} while (console.log("PASS"));
2036-
var a;
2037-
}
2038-
expect_stdout: "PASS"
2039-
node_version: ">=6"
2040-
}
2041-
20422008
issue_5246_1: {
20432009
options = {
20442010
pure_getters: true,

test/compress/destructured.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3368,6 +3368,40 @@ issue_5189_2: {
33683368
node_version: ">=6"
33693369
}
33703370

3371+
issue_5222: {
3372+
options = {
3373+
hoist_props: true,
3374+
inline: true,
3375+
reduce_vars: true,
3376+
side_effects: true,
3377+
toplevel: true,
3378+
unused: true,
3379+
}
3380+
input: {
3381+
function f() {
3382+
do {
3383+
(function() {
3384+
var a = {
3385+
p: [ a ] = [],
3386+
};
3387+
})();
3388+
} while (console.log("PASS"));
3389+
}
3390+
f();
3391+
}
3392+
expect: {
3393+
do {
3394+
a = void 0,
3395+
a = {
3396+
p: [ a ] = [],
3397+
};
3398+
} while (console.log("PASS"));
3399+
var a;
3400+
}
3401+
expect_stdout: "PASS"
3402+
node_version: ">=6"
3403+
}
3404+
33713405
issue_5288: {
33723406
options = {
33733407
conditionals: true,

0 commit comments

Comments
 (0)