(
this: Parser,
startLoc: Position,
soloAwait?: boolean,
)
| 2977 | // Parses await expression inside async function. |
| 2978 | |
| 2979 | parseAwait( |
| 2980 | this: Parser, |
| 2981 | startLoc: Position, |
| 2982 | soloAwait?: boolean, |
| 2983 | ): N.AwaitExpression { |
| 2984 | const startIndex = startLoc.index; |
| 2985 | const node = this.startNodeAt<N.AwaitExpression>(startLoc); |
| 2986 | |
| 2987 | this.expressionScope.recordParameterInitializerError( |
| 2988 | Errors.AwaitExpressionFormalParameter, |
| 2989 | startIndex, |
| 2990 | ); |
| 2991 | |
| 2992 | if (this.eat(tt.star)) { |
| 2993 | this.raise(Errors.ObsoleteAwaitStar, startLoc); |
| 2994 | } |
| 2995 | |
| 2996 | if ( |
| 2997 | !this.scope.inFunction && |
| 2998 | !(this.optionFlags & OptionFlags.AllowAwaitOutsideFunction) |
| 2999 | ) { |
| 3000 | if (this.isAmbiguousPrefixOrIdentifier()) { |
| 3001 | this.ambiguousScriptDifferentAst = true; |
| 3002 | } else { |
| 3003 | this.sawUnambiguousESM = true; |
| 3004 | } |
| 3005 | } |
| 3006 | |
| 3007 | if (!soloAwait) { |
| 3008 | this.state.canStartArrow = false; |
| 3009 | node.argument = this.parseMaybeUnary(null, true); |
| 3010 | } |
| 3011 | |
| 3012 | return this.finishNode(node, "AwaitExpression"); |
| 3013 | } |
| 3014 | |
| 3015 | isAmbiguousPrefixOrIdentifier(): boolean { |
| 3016 | if (this.hasPrecedingLineBreak()) return true; |
nothing calls this directly
no test coverage detected