(
this: Parser,
)
| 2500 | } |
| 2501 | |
| 2502 | parseExportDefaultExpression( |
| 2503 | this: Parser, |
| 2504 | ): N.ExportDefaultDeclaration["declaration"] { |
| 2505 | const expr = this.startNode(); |
| 2506 | |
| 2507 | if (this.match(tt._function)) { |
| 2508 | this.next(); |
| 2509 | return this.parseFunction( |
| 2510 | expr, |
| 2511 | ParseFunctionFlag.Declaration | ParseFunctionFlag.NullableId, |
| 2512 | ); |
| 2513 | } else if (this.isAsyncFunction()) { |
| 2514 | this.next(); // eat 'async' |
| 2515 | this.next(); // eat 'function' |
| 2516 | return this.parseFunction( |
| 2517 | expr, |
| 2518 | ParseFunctionFlag.Declaration | |
| 2519 | ParseFunctionFlag.NullableId | |
| 2520 | ParseFunctionFlag.Async, |
| 2521 | ); |
| 2522 | } |
| 2523 | |
| 2524 | if (this.match(tt._class)) { |
| 2525 | return this.parseClass(expr, true, true); |
| 2526 | } |
| 2527 | |
| 2528 | if (this.isContextual(tt._struct)) { |
| 2529 | const next = this.nextTokenInLineStart(); |
| 2530 | const nextCh = this.codePointAtPos(next); |
| 2531 | if ( |
| 2532 | nextCh === charCodes.leftCurlyBrace || |
| 2533 | this.chStartsBindingIdentifier(nextCh, next) |
| 2534 | ) { |
| 2535 | this.expectPlugin("structs"); |
| 2536 | return this.parseStructDeclaration(expr, true); |
| 2537 | } |
| 2538 | } |
| 2539 | |
| 2540 | if (this.match(tt.at)) { |
| 2541 | return this.parseClass( |
| 2542 | this.maybeTakeDecorators( |
| 2543 | this.parseDecorators(false), |
| 2544 | this.startNode<N.ClassDeclaration>(), |
| 2545 | ), |
| 2546 | true, |
| 2547 | true, |
| 2548 | ); |
| 2549 | } |
| 2550 | |
| 2551 | if ( |
| 2552 | this.match(tt._const) || |
| 2553 | this.match(tt._var) || |
| 2554 | (this.isLet() && |
| 2555 | !this.isReservedWordOnNewLineAfterLet(this.nextTokenStart())) || |
| 2556 | this.isUsing() || |
| 2557 | this.isAwaitUsing() |
| 2558 | ) { |
| 2559 | throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc); |
nothing calls this directly
no test coverage detected