MCPcopy Create free account
hub / github.com/babel/babel / shouldParseExportDeclaration

Function shouldParseExportDeclaration

packages/babel-parser/src/parser/statement.ts:2675–2703  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2673 }
2674
2675 shouldParseExportDeclaration(): boolean {
2676 const { type } = this.state;
2677 if (type === tt.at) {
2678 this.expectOnePlugin(["decorators", "decorators-legacy"]);
2679 if (this.hasPlugin("decorators")) {
2680 return true;
2681 }
2682 }
2683
2684 if (this.isUsing()) {
2685 this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
2686 return true;
2687 }
2688
2689 if (this.isAwaitUsing()) {
2690 this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
2691 return true;
2692 }
2693
2694 return (
2695 type === tt._var ||
2696 type === tt._const ||
2697 type === tt._function ||
2698 type === tt._class ||
2699 this.isLet() ||
2700 this.isAsyncFunction() ||
2701 (this.isContextual(tt._struct) && this.nextTokenIsIdentifierOnSameLine())
2702 );
2703 }
2704
2705 // Check for duplicate exports
2706 checkNamedExport(

Callers

nothing calls this directly

Calls 1

hasPluginMethod · 0.80

Tested by

no test coverage detected