Conversation
| // From ES6 spec: | ||
| // AsyncArrowFunction[In, Yield, Await]:: | ||
| // async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] | ||
| const unParenthesizedAsyncArrowFunction = tryParseUnParenthesizedAsyncArrowFunctionExpressionWorker(); |
There was a problem hiding this comment.
help! it's the MicroSoft BiCapitalisation DisEase!
should be unparenthensizedAsyncArrowFunction and tryParseUnparenthesizedAsyncArrowFunctionExpressionWorker :)
| } | ||
|
|
||
| // From ES6 spec: | ||
| // AsyncArrowFunction[In, Yield, Await]:: |
There was a problem hiding this comment.
how is this presented in the spec? I feel like it should be integrated into the grammar production list (1,2,3,4,5) above, as well as in the code. For example, it could be
const arrowExpression = tryParseParen... || tryParseUnparen ...;
if (arrowExpression) { return arrowExpression; }There was a problem hiding this comment.
That is a good point. the comment is what it is in the spec. It is the upcomment spec for async await
| // Production (1) of AsyncArrowFunctionExpression is parsed in "tryParseAsyncSimpleArrowFunctionExpression". | ||
| // And production (2) is parsed in "tryParseParenthesizedArrowFunctionExpression". | ||
| // | ||
| // If we do successfully parse arrow-function, we must * not * recurse for productions 1, 2 or 3. An ArrowFunction is |
There was a problem hiding this comment.
minor: no spaces around the stars in not
|
👍 with a couple of minor suggestions |
| } | ||
|
|
||
| function tryParseAsyncSimpleArrowFunctionExpression(): ArrowFunction { | ||
| const isUnParenthesizedAsyncArrowFunction = lookAhead(isUnParenthesizedAsyncArrowFunctionWorker); |
There was a problem hiding this comment.
can you check first that token === SyntaxKind.AsyncKeyword before calling the function?
There was a problem hiding this comment.
Sure. I just realize I should do that since lookAhead can be expensive
Fix #8262