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

Function shouldParseExportDeclaration

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

hasPluginMethod · 0.80

Tested by

no test coverage detected