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

Function parseStructBody

packages/babel-parser/src/parser/statement.ts:2246–2274  ·  view source on GitHub ↗
(
    this: Parser,
    hadSuperClass: boolean,
    oldStrict: boolean,
  )

Source from the content-addressed store, hash-verified

2244 }
2245
2246 parseStructBody(
2247 this: Parser,
2248 hadSuperClass: boolean,
2249 oldStrict: boolean,
2250 ): N.StructBody {
2251 this.classScope.enter();
2252
2253 const state: N.ParseClassMemberState = {
2254 hadConstructor: false,
2255 hadSuperClass,
2256 };
2257 const structBody = this.startNode<N.StructBody>();
2258 structBody.body = [];
2259 this.expect(tt.braceL);
2260
2261 while (!this.match(tt.braceR)) {
2262 if (this.eat(tt.semi)) {
2263 continue;
2264 }
2265 const member = this.startNode<N.ClassMember>();
2266 this.parseClassMember(structBody, member, state);
2267 }
2268
2269 this.state.strict = oldStrict;
2270 this.next(); // eat `}`
2271 this.classScope.exit();
2272
2273 return this.finishNode(structBody, "StructBody");
2274 }
2275
2276 // Parses module export declaration.
2277 // https://tc39.es/ecma262/#prod-ExportDeclaration

Callers

nothing calls this directly

Calls 6

matchMethod · 0.80
nextMethod · 0.80
finishNodeMethod · 0.80
enterMethod · 0.45
parseClassMemberMethod · 0.45
exitMethod · 0.45

Tested by

no test coverage detected