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

Method parseWithStatement

src/parser.ts:2422–2443  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2420 // https://tc39.github.io/ecma262/#sec-with-statement
2421
2422 parseWithStatement(): Node.WithStatement {
2423 if (this.context.strict) {
2424 this.tolerateError(Messages.StrictModeWith);
2425 }
2426
2427 const node = this.createNode();
2428 let body;
2429
2430 this.expectKeyword('with');
2431 this.expect('(');
2432 const object = this.parseExpression();
2433
2434 if (!this.match(')') && this.config.tolerant) {
2435 this.tolerateUnexpectedToken(this.nextToken());
2436 body = this.finalize(this.createNode(), new Node.EmptyStatement());
2437 } else {
2438 this.expect(')');
2439 body = this.parseStatement();
2440 }
2441
2442 return this.finalize(node, new Node.WithStatement(object, body));
2443 }
2444
2445 // https://tc39.github.io/ecma262/#sec-switch-statement
2446

Callers 1

parseStatementMethod · 0.95

Calls 10

tolerateErrorMethod · 0.95
createNodeMethod · 0.95
expectKeywordMethod · 0.95
expectMethod · 0.95
parseExpressionMethod · 0.95
matchMethod · 0.95
nextTokenMethod · 0.95
finalizeMethod · 0.95
parseStatementMethod · 0.95

Tested by

no test coverage detected