()
| 1639 | } |
| 1640 | |
| 1641 | parseAssignmentExpression(): Node.Expression { |
| 1642 | let expr; |
| 1643 | |
| 1644 | if (!this.context.allowYield && this.matchKeyword('yield')) { |
| 1645 | expr = this.parseYieldExpression(); |
| 1646 | } else { |
| 1647 | const startToken = this.lookahead; |
| 1648 | let token = startToken; |
| 1649 | expr = this.parseConditionalExpression(); |
| 1650 | |
| 1651 | if (token.type === Token.Identifier && (token.lineNumber === this.lookahead.lineNumber) && token.value === 'async') { |
| 1652 | if (this.lookahead.type === Token.Identifier || this.matchKeyword('yield')) { |
| 1653 | const arg = this.parsePrimaryExpression(); |
| 1654 | this.reinterpretExpressionAsPattern(arg); |
| 1655 | expr = { |
| 1656 | type: ArrowParameterPlaceHolder, |
| 1657 | params: [arg], |
| 1658 | async: true |
| 1659 | }; |
| 1660 | } |
| 1661 | } |
| 1662 | |
| 1663 | if (expr.type === ArrowParameterPlaceHolder || this.match('=>')) { |
| 1664 | |
| 1665 | // https://tc39.github.io/ecma262/#sec-arrow-function-definitions |
| 1666 | this.context.isAssignmentTarget = false; |
| 1667 | this.context.isBindingElement = false; |
| 1668 | const isAsync = expr.async; |
| 1669 | const list = this.reinterpretAsCoverFormalsList(expr); |
| 1670 | |
| 1671 | if (list) { |
| 1672 | if (this.hasLineTerminator) { |
| 1673 | this.tolerateUnexpectedToken(this.lookahead); |
| 1674 | } |
| 1675 | this.context.firstCoverInitializedNameError = null; |
| 1676 | |
| 1677 | const previousStrict = this.context.strict; |
| 1678 | const previousAllowStrictDirective = this.context.allowStrictDirective; |
| 1679 | this.context.allowStrictDirective = list.simple; |
| 1680 | |
| 1681 | const previousAllowYield = this.context.allowYield; |
| 1682 | const previousAwait = this.context.await; |
| 1683 | this.context.allowYield = true; |
| 1684 | this.context.await = isAsync; |
| 1685 | |
| 1686 | const node = this.startNode(startToken); |
| 1687 | this.expect('=>'); |
| 1688 | let body: Node.BlockStatement | Node.Expression; |
| 1689 | if (this.match('{')) { |
| 1690 | const previousAllowIn = this.context.allowIn; |
| 1691 | this.context.allowIn = true; |
| 1692 | body = this.parseFunctionSourceElements(); |
| 1693 | this.context.allowIn = previousAllowIn; |
| 1694 | } else { |
| 1695 | body = this.isolateCoverGrammar(this.parseAssignmentExpression); |
| 1696 | } |
| 1697 | const expression = body.type !== Syntax.BlockStatement; |
| 1698 |
no test coverage detected