Skip to content

Commit

Permalink
fix performance regression (#5302)
Browse files Browse the repository at this point in the history
fixes #5297
  • Loading branch information
alexlamsl committed Jan 17, 2022
1 parent 774feea commit 43807c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 1 addition & 2 deletions lib/compress.js
Expand Up @@ -13262,8 +13262,7 @@ Compressor.prototype.compress = function(node) {
def(AST_New, noop);
def(AST_Return, function(compressor, scope, no_return, in_loop) {
var value = this.value;
if (value) value = value.try_inline(compressor, scope, undefined, in_loop === "try");
return value || this;
return value && value.try_inline(compressor, scope, undefined, in_loop === "try");
});
function inline_sequence(compressor, scope, no_return, in_loop, node, skip) {
var body = [], exprs = node.expressions, no_ret = no_return;
Expand Down
13 changes: 8 additions & 5 deletions test/compress/functions.js
Expand Up @@ -6146,18 +6146,21 @@ issue_4265: {
a;
var a;
}() ]);
return 0;
return 42;
}
f();
console.log(f());
}
expect: {
function f() {
var a;
return console, console.log(a), 0;
return console, console.log(a), 42;
}
f();
console.log(f());
}
expect_stdout: "undefined"
expect_stdout: [
"undefined",
"42",
]
}

trailing_comma: {
Expand Down

0 comments on commit 43807c2

Please sign in to comment.