fix AST corruption during inline of simple return (#3056)

fixes #3054
This commit is contained in:
Alex Lam S.L
2018-04-06 05:39:07 +08:00
committed by GitHub
parent b5bab254ce
commit 44116c6d2b
2 changed files with 36 additions and 1 deletions

View File

@@ -4576,7 +4576,12 @@ merge(Compressor.prototype, {
if (compressor.option("inline") && stat instanceof AST_Return) {
var value = stat.value;
if (!value || value.is_constant_expression()) {
var args = self.args.concat(value || make_node(AST_Undefined, self));
if (value) {
value = value.clone(true);
} else {
value = make_node(AST_Undefined, self);
}
var args = self.args.concat(value);
return make_sequence(self, args).optimize(compressor);
}
}