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

Function parseSuper

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

Source from the content-addressed store, hash-verified

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