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

Method parseLeftHandSideExpression

src/parser.ts:1313–1346  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1311 }
1312
1313 parseLeftHandSideExpression(): Node.Expression {
1314 assert(this.context.allowIn, 'callee of new expression always allow in keyword.');
1315
1316 const node = this.startNode(this.lookahead);
1317 let expr = (this.matchKeyword('super') && this.context.inFunctionBody) ? this.parseSuper() :
1318 this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression);
1319
1320 while (true) {
1321 if (this.match('[')) {
1322 this.context.isBindingElement = false;
1323 this.context.isAssignmentTarget = true;
1324 this.expect('[');
1325 const property = this.isolateCoverGrammar(this.parseExpression);
1326 this.expect(']');
1327 expr = this.finalize(node, new Node.ComputedMemberExpression(expr, property));
1328
1329 } else if (this.match('.')) {
1330 this.context.isBindingElement = false;
1331 this.context.isAssignmentTarget = true;
1332 this.expect('.');
1333 const property = this.parseIdentifierName();
1334 expr = this.finalize(node, new Node.StaticMemberExpression(expr, property));
1335
1336 } else if (this.lookahead.type === Token.Template && this.lookahead.head) {
1337 const quasi = this.parseTemplateLiteral();
1338 expr = this.finalize(node, new Node.TaggedTemplateExpression(expr, quasi));
1339
1340 } else {
1341 break;
1342 }
1343 }
1344
1345 return expr;
1346 }
1347
1348 // https://tc39.github.io/ecma262/#sec-update-expressions
1349

Callers

nothing calls this directly

Calls 11

startNodeMethod · 0.95
matchKeywordMethod · 0.95
parseSuperMethod · 0.95
inheritCoverGrammarMethod · 0.95
matchMethod · 0.95
expectMethod · 0.95
isolateCoverGrammarMethod · 0.95
finalizeMethod · 0.95
parseIdentifierNameMethod · 0.95
parseTemplateLiteralMethod · 0.95
assertFunction · 0.90

Tested by

no test coverage detected