}
}
if (exp instanceof AST_Function) {
- if (exp.body[0] instanceof AST_Return
- && exp.body[0].value.is_constant()) {
- var args = self.args.concat(exp.body[0].value);
- return AST_Seq.from_array(args).transform(compressor);
+ if (exp.body[0] instanceof AST_Return) {
+ var value = exp.body[0].value;
+ if (!value || value.is_constant()) {
+ var args = self.args.concat(value || make_node(AST_Undefined, self));
+ return AST_Seq.from_array(args).transform(compressor);
+ }
}
if (compressor.option("side_effects")) {
if (!AST_Block.prototype.has_side_effects.call(exp, compressor)) {