Skip to content

Commit 43807c2

Browse files
authored
fix performance regression (#5302)
fixes #5297
1 parent 774feea commit 43807c2

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

lib/compress.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13262,8 +13262,7 @@ Compressor.prototype.compress = function(node) {
1326213262
def(AST_New, noop);
1326313263
def(AST_Return, function(compressor, scope, no_return, in_loop) {
1326413264
var value = this.value;
13265-
if (value) value = value.try_inline(compressor, scope, undefined, in_loop === "try");
13266-
return value || this;
13265+
return value && value.try_inline(compressor, scope, undefined, in_loop === "try");
1326713266
});
1326813267
function inline_sequence(compressor, scope, no_return, in_loop, node, skip) {
1326913268
var body = [], exprs = node.expressions, no_ret = no_return;

test/compress/functions.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6146,18 +6146,21 @@ issue_4265: {
61466146
a;
61476147
var a;
61486148
}() ]);
6149-
return 0;
6149+
return 42;
61506150
}
6151-
f();
6151+
console.log(f());
61526152
}
61536153
expect: {
61546154
function f() {
61556155
var a;
6156-
return console, console.log(a), 0;
6156+
return console, console.log(a), 42;
61576157
}
6158-
f();
6158+
console.log(f());
61596159
}
6160-
expect_stdout: "undefined"
6160+
expect_stdout: [
6161+
"undefined",
6162+
"42",
6163+
]
61616164
}
61626165

61636166
trailing_comma: {

0 commit comments

Comments
 (0)