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

Function parseStructDeclaration

packages/babel-parser/src/parser/statement.ts:2227–2244  ·  view source on GitHub ↗
(
    this: Parser,
    node: Undone<N.StructDeclaration>,
    optionalId?: boolean | null,
  )

Source from the content-addressed store, hash-verified

2225 }
2226
2227 parseStructDeclaration(
2228 this: Parser,
2229 node: Undone<N.StructDeclaration>,
2230 optionalId?: boolean | null,
2231 ): N.StructDeclaration {
2232 this.next(); // 'struct'
2233
2234 // A struct definition is always strict mode code.
2235 const oldStrict = this.state.strict;
2236 this.state.strict = true;
2237
2238 this.parseClassId(node, true, optionalId);
2239 this.parseClassSuper(node);
2240 // this.state.strict is restored in parseStructBody
2241 node.body = this.parseStructBody(!!node.superClass, oldStrict);
2242
2243 return this.finishNode(node, "StructDeclaration");
2244 }
2245
2246 parseStructBody(
2247 this: Parser,

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