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

Function parseClass

packages/babel-parser/src/parser/statement.ts:1608–1629  ·  view source on GitHub ↗
(
    this: Parser,
    node: Undone<T>,
    isStatement: /* T === ClassDeclaration */ boolean,
    optionalId?: boolean,
  )

Source from the content-addressed store, hash-verified

1606 // `isStatement` parameter).
1607
1608 parseClass<T extends N.Class>(
1609 this: Parser,
1610 node: Undone<T>,
1611 isStatement: /* T === ClassDeclaration */ boolean,
1612 optionalId?: boolean,
1613 ): T {
1614 this.next(); // 'class'
1615
1616 // A class definition is always strict mode code.
1617 const oldStrict = this.state.strict;
1618 this.state.strict = true;
1619
1620 this.parseClassId(node, isStatement, optionalId);
1621 this.parseClassSuper(node);
1622 // this.state.strict is restored in parseClassBody
1623 node.body = this.parseClassBody(!!node.superClass, oldStrict);
1624
1625 return this.finishNode(
1626 node,
1627 isStatement ? "ClassDeclaration" : "ClassExpression",
1628 );
1629 }
1630
1631 isClassProperty(): boolean {
1632 return (

Callers

nothing calls this directly

Calls 4

nextMethod · 0.80
finishNodeMethod · 0.80
parseClassIdMethod · 0.45
parseClassSuperMethod · 0.45

Tested by

no test coverage detected