MCPcopy
hub / github.com/jquery/esprima / parseClassExpression

Method parseClassExpression

src/parser.ts:3305–3321  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3303 }
3304
3305 parseClassExpression(): Node.ClassExpression {
3306 const node = this.createNode();
3307
3308 const previousStrict = this.context.strict;
3309 this.context.strict = true;
3310 this.expectKeyword('class');
3311 const id = (this.lookahead.type === Token.Identifier) ? this.parseVariableIdentifier() : null;
3312 let superClass: Node.Identifier | null = null;
3313 if (this.matchKeyword('extends')) {
3314 this.nextToken();
3315 superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
3316 }
3317 const classBody = this.parseClassBody();
3318 this.context.strict = previousStrict;
3319
3320 return this.finalize(node, new Node.ClassExpression(id, superClass, classBody));
3321 }
3322
3323 // https://tc39.github.io/ecma262/#sec-scripts
3324 // https://tc39.github.io/ecma262/#sec-modules

Callers 1

Calls 8

createNodeMethod · 0.95
expectKeywordMethod · 0.95
matchKeywordMethod · 0.95
nextTokenMethod · 0.95
isolateCoverGrammarMethod · 0.95
parseClassBodyMethod · 0.95
finalizeMethod · 0.95

Tested by

no test coverage detected