fix corner case in inline (#5311)

fixes #5222
This commit is contained in:
Alex Lam S.L
2022-01-25 16:47:24 +00:00
committed by GitHub
parent b46c7944c6
commit b9b2a4f7f8
3 changed files with 34 additions and 35 deletions

View File

@@ -8002,7 +8002,6 @@ Compressor.prototype.compress = function(node) {
var defs = defs_by_id[node.definition().id];
if (!defs) return;
if (node.fixed_value() !== defs.value) return;
if (is_lhs(node, this.parent())) return;
return make_node(AST_Object, node, { properties: [] });
}
}));

View File

@@ -2005,40 +2005,6 @@ issue_5192: {
node_version: ">=6"
}
issue_5222: {
options = {
hoist_props: true,
inline: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
unused: true,
}
input: {
function f() {
do {
(function() {
var a = {
p: [ a ] = [],
};
})();
} while (console.log("PASS"));
}
f();
}
expect: {
do {
a = void 0,
a = {
p: [ a ] = [],
};
} while (console.log("PASS"));
var a;
}
expect_stdout: "PASS"
node_version: ">=6"
}
issue_5246_1: {
options = {
pure_getters: true,

View File

@@ -3368,6 +3368,40 @@ issue_5189_2: {
node_version: ">=6"
}
issue_5222: {
options = {
hoist_props: true,
inline: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
unused: true,
}
input: {
function f() {
do {
(function() {
var a = {
p: [ a ] = [],
};
})();
} while (console.log("PASS"));
}
f();
}
expect: {
do {
a = void 0,
a = {
p: [ a ] = [],
};
} while (console.log("PASS"));
var a;
}
expect_stdout: "PASS"
node_version: ">=6"
}
issue_5288: {
options = {
conditionals: true,