MCPcopy Index your code
hub / github.com/jquery/esprima / parseConditionalExpression

Method parseConditionalExpression

src/parser.ts:1524–1545  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1522 // https://tc39.github.io/ecma262/#sec-conditional-operator
1523
1524 parseConditionalExpression(): Node.Expression {
1525 const startToken = this.lookahead;
1526
1527 let expr = this.inheritCoverGrammar(this.parseBinaryExpression);
1528 if (this.match('?')) {
1529 this.nextToken();
1530
1531 const previousAllowIn = this.context.allowIn;
1532 this.context.allowIn = true;
1533 const consequent = this.isolateCoverGrammar(this.parseAssignmentExpression);
1534 this.context.allowIn = previousAllowIn;
1535
1536 this.expect(':');
1537 const alternate = this.isolateCoverGrammar(this.parseAssignmentExpression);
1538
1539 expr = this.finalize(this.startNode(startToken), new Node.ConditionalExpression(expr, consequent, alternate));
1540 this.context.isAssignmentTarget = false;
1541 this.context.isBindingElement = false;
1542 }
1543
1544 return expr;
1545 }
1546
1547 // https://tc39.github.io/ecma262/#sec-assignment-operators
1548

Callers 1

Calls 7

inheritCoverGrammarMethod · 0.95
matchMethod · 0.95
nextTokenMethod · 0.95
isolateCoverGrammarMethod · 0.95
expectMethod · 0.95
finalizeMethod · 0.95
startNodeMethod · 0.95

Tested by

no test coverage detected