Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per ECMAScript spec, function body {...} is not a block #2067

Open
zhanzhenzhen opened this issue Feb 1, 2021 · 2 comments
Open

Per ECMAScript spec, function body {...} is not a block #2067

zhanzhenzhen opened this issue Feb 1, 2021 · 2 comments

Comments

@zhanzhenzhen
Copy link

ECMAScript 2021:
https://tc39.es/ecma262/#sec-function-definitions

ECMAScript 5.1:
https://262.ecma-international.org/5.1/#sec-13

@Meir017
Copy link
Contributor

Meir017 commented Feb 2, 2021

@zhanzhenzhen can you add some code to show your scenario?

@zhanzhenzhen
Copy link
Author

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] }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants