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

Function parseStructDeclaration

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

Source from the content-addressed store, hash-verified

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