fix corner case in if_return (#5603)

fixes #5602
This commit is contained in:
Alex Lam S.L
2022-08-06 00:56:20 +01:00
committed by GitHub
parent 8a07f1202c
commit a9d9af53e9
2 changed files with 52 additions and 2 deletions

View File

@@ -3595,8 +3595,8 @@ Compressor.prototype.compress = function(node) {
stat = stat.clone();
exprs.push(stat.condition);
stat.condition = make_sequence(stat, exprs);
stat.alternative = make_node(AST_BlockStatement, next, {
body: extract_functions().concat(make_node(AST_Return, next, { value: null })),
stat.alternative = make_node(AST_BlockStatement, self, {
body: extract_functions().concat(make_node(AST_Return, self, { value: null })),
});
statements[i] = stat.transform(compressor);
i = prev + 1;