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

Function parseClass

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

Source from the content-addressed store, hash-verified

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