Skip to content

Commit

Permalink
fix corner case in inline (#5311)
Browse files Browse the repository at this point in the history
fixes #5222
  • Loading branch information
alexlamsl committed Jan 25, 2022
1 parent b46c794 commit b9b2a4f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 35 deletions.
1 change: 0 additions & 1 deletion lib/compress.js
Expand Up @@ -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: [] });
}
}));
Expand Down
34 changes: 0 additions & 34 deletions test/compress/default-values.js
Expand Up @@ -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,
Expand Down
34 changes: 34 additions & 0 deletions test/compress/destructured.js
Expand Up @@ -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,
Expand Down

0 comments on commit b9b2a4f

Please sign in to comment.