fix corner cases with export default (#4673)
This commit is contained in:
@@ -1060,7 +1060,7 @@ var AST_ExportDeclaration = DEFNODE("ExportDeclaration", "body", {
|
||||
var AST_ExportDefault = DEFNODE("ExportDefault", "body", {
|
||||
$documentation: "An `export default` statement",
|
||||
$propdoc: {
|
||||
body: "[AST_Node] an expression node (should not be instanceof AST_Statement)",
|
||||
body: "[AST_Node] the default export",
|
||||
},
|
||||
walk: function(visitor) {
|
||||
var node = this;
|
||||
@@ -1069,7 +1069,11 @@ var AST_ExportDefault = DEFNODE("ExportDefault", "body", {
|
||||
});
|
||||
},
|
||||
_validate: function() {
|
||||
must_be_expression(this, "body");
|
||||
if (this.body instanceof AST_Lambda && this.body.name) {
|
||||
if (!(this.body instanceof AST_LambdaDefinition)) throw new Error("body must be AST_LambdaDefinition");
|
||||
} else {
|
||||
must_be_expression(this, "body");
|
||||
}
|
||||
},
|
||||
}, AST_Statement);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user