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

Function parseDecorators

packages/babel-parser/src/parser/statement.ts:652–667  ·  view source on GitHub ↗
(this: Parser, allowExport?: boolean)

Source from the content-addressed store, hash-verified

650 }
651
652 parseDecorators(this: Parser, allowExport?: boolean): N.Decorator[] {
653 const decorators = [];
654 do {
655 decorators.push(this.parseDecorator());
656 } while (this.match(tt.at));
657
658 if (this.match(tt._export)) {
659 if (!allowExport) {
660 this.unexpected();
661 }
662 } else if (!this.canHaveLeadingDecorator()) {
663 throw this.raise(Errors.UnexpectedLeadingDecorator, this.state.startLoc);
664 }
665
666 return decorators;
667 }
668
669 parseDecorator(this: Parser): N.Decorator {
670 this.expectOnePlugin(["decorators", "decorators-legacy"]);

Callers

nothing calls this directly

Calls 3

matchMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected