()
| 6417 | } |
| 6418 | |
| 6419 | function parseAssignmentExpression() { |
| 6420 | var marker, expr, token, params, oldParenthesizedCount, |
| 6421 | startsWithParen = false, backtrackToken = lookahead, |
| 6422 | possiblyAsync = false; |
| 6423 | |
| 6424 | if (matchYield()) { |
| 6425 | return parseYieldExpression(); |
| 6426 | } |
| 6427 | |
| 6428 | if (matchAwait()) { |
| 6429 | return parseAwaitExpression(); |
| 6430 | } |
| 6431 | |
| 6432 | oldParenthesizedCount = state.parenthesizedCount; |
| 6433 | |
| 6434 | marker = markerCreate(); |
| 6435 | |
| 6436 | if (matchAsyncFuncExprOrDecl()) { |
| 6437 | return parseFunctionExpression(); |
| 6438 | } |
| 6439 | |
| 6440 | if (matchAsync()) { |
| 6441 | // We can't be completely sure that this 'async' token is |
| 6442 | // actually a contextual keyword modifying a function |
| 6443 | // expression, so we might have to un-lex() it later by |
| 6444 | // calling rewind(backtrackToken). |
| 6445 | possiblyAsync = true; |
| 6446 | lex(); |
| 6447 | } |
| 6448 | |
| 6449 | if (match('(')) { |
| 6450 | token = lookahead2(); |
| 6451 | if ((token.type === Token.Punctuator && token.value === ')') || token.value === '...') { |
| 6452 | params = parseParams(); |
| 6453 | if (!match('=>')) { |
| 6454 | throwUnexpected(lex()); |
| 6455 | } |
| 6456 | params.async = possiblyAsync; |
| 6457 | return parseArrowFunctionExpression(params, marker); |
| 6458 | } |
| 6459 | startsWithParen = true; |
| 6460 | } |
| 6461 | |
| 6462 | token = lookahead; |
| 6463 | |
| 6464 | // If the 'async' keyword is not followed by a '(' character or an |
| 6465 | // identifier, then it can't be an arrow function modifier, and we |
| 6466 | // should interpret it as a normal identifer. |
| 6467 | if (possiblyAsync && !match('(') && token.type !== Token.Identifier) { |
| 6468 | possiblyAsync = false; |
| 6469 | rewind(backtrackToken); |
| 6470 | } |
| 6471 | |
| 6472 | expr = parseConditionalExpression(); |
| 6473 | |
| 6474 | if (match('=>') && |
| 6475 | (state.parenthesizedCount === oldParenthesizedCount || |
| 6476 | state.parenthesizedCount === (oldParenthesizedCount + 1))) { |
no test coverage detected