fix corner cases with export default (#4673)
This commit is contained in:
@@ -663,14 +663,11 @@ function OutputStream(options) {
|
||||
// the first token to appear in a statement.
|
||||
function needs_parens_function(output) {
|
||||
if (!output.has_parens() && first_in_statement(output)) return true;
|
||||
if (output.option("webkit")) {
|
||||
var p = output.parent();
|
||||
if (p instanceof AST_PropAccess && p.expression === this) return true;
|
||||
}
|
||||
if (output.option("wrap_iife")) {
|
||||
var p = output.parent();
|
||||
if (p instanceof AST_Call && p.expression === this) return true;
|
||||
}
|
||||
var p = output.parent();
|
||||
// export default (function() {})()
|
||||
if (p && p.TYPE == "Call" && output.parent(1) instanceof AST_ExportDefault) return true;
|
||||
if (output.option("webkit") && p instanceof AST_PropAccess && p.expression === this) return true;
|
||||
if (output.option("wrap_iife") && p instanceof AST_Call && p.expression === this) return true;
|
||||
}
|
||||
PARENS(AST_AsyncFunction, needs_parens_function);
|
||||
PARENS(AST_AsyncGeneratorFunction, needs_parens_function);
|
||||
@@ -1018,7 +1015,7 @@ function OutputStream(options) {
|
||||
output.print("default");
|
||||
output.space();
|
||||
this.body.print(output);
|
||||
output.semicolon();
|
||||
if (!(this.body instanceof AST_Lambda) || is_arrow(this.body)) output.semicolon();
|
||||
});
|
||||
DEFPRINT(AST_ExportForeign, function(output) {
|
||||
var self = this;
|
||||
|
||||
Reference in New Issue
Block a user