As I understand it, there are two kinds of arrow function body: concise and verbose.
()=>1 // Concise
()=>{} // Not concise?
Concise lacks braces and is an AssignmentExpression
, and verbose is presumably a block, but I am not sure.
14.2 of the spec defines the grammar of arrow functions, but it appears to include braces in the definition of the concise body.
1. ConciseBody[In]:
2. [lookahead ≠ {]ExpressionBody[?In, ~Await]
3. {FunctionBody[~Yield, ~Await]}
Where am I going wrong? Where is the "verbose" body grammar defined in the spec?
It looks like it's specifying two options under ConciseBody: either an ExpressionBody (no brackets) OR a FunctionBody wrapped in brackets.
The format for how the spec is written is explained under "Grammar Notation", https://tc39.es/ecma262/#sec-grammar-notation