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

Function parseSuper

packages/babel-parser/src/parser/expression.ts:1602–1620  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1600
1601 // Parse the `super` keyword
1602 parseSuper(): N.Super {
1603 const node = this.startNode<N.Super>();
1604 this.next(); // eat `super`
1605 if (this.match(tt.parenL) && !this.scope.allowDirectSuper) {
1606 this.raise(Errors.SuperNotAllowed, node);
1607 } else if (!this.scope.allowSuper) {
1608 this.raise(Errors.UnexpectedSuper, node);
1609 }
1610
1611 if (
1612 !this.match(tt.parenL) &&
1613 !this.match(tt.bracketL) &&
1614 !this.match(tt.dot)
1615 ) {
1616 this.raise(Errors.UnsupportedSuper, node);
1617 }
1618
1619 return this.finishNode(node, "Super");
1620 }
1621
1622 parsePrivateName(): N.PrivateName {
1623 const node = this.startNode<N.PrivateName>();

Callers

nothing calls this directly

Calls 3

nextMethod · 0.80
matchMethod · 0.80
finishNodeMethod · 0.80

Tested by

no test coverage detected