Open zhanzhenzhen opened 3 years ago
@zhanzhenzhen can you add some code to show your scenario?
function a() {}
{
"type": "Program",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "a"
},
"params": [],
"body": {
"type": "BlockStatement",
"body": []
},
"generator": false,
"expression": false,
"async": false
}
],
"sourceType": "script"
}
But the ECMAScript specification says function
body is neither a block nor a statement.
function BindingIdentifier[?Yield, ?Await] ( FormalParameters[~Yield, ~Await] ) { FunctionBody[~Yield, ~Await] }
ECMAScript 2021: https://tc39.es/ecma262/#sec-function-definitions
ECMAScript 5.1: https://262.ecma-international.org/5.1/#sec-13