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

Function parseStructBody

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

Source from the content-addressed store, hash-verified

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