Browse Source

Set `in` to `true` when parsing AssignmentExpression in ConditionalExpression (#2386)

This Pull Request fixes the following:

- Set `in` to `true` when parsing AssignmentExpression in ConditionalExpression
pull/2389/head
raskad 2 years ago
parent
commit
786357919f
  1. 10
      boa_engine/src/syntax/parser/expression/assignment/conditional.rs

10
boa_engine/src/syntax/parser/expression/assignment/conditional.rs

@ -80,13 +80,9 @@ where
if let Some(tok) = cursor.peek(0, interner)? {
if tok.kind() == &TokenKind::Punctuator(Punctuator::Question) {
cursor.next(interner)?.expect("? character vanished"); // Consume the token.
let then_clause = AssignmentExpression::new(
None,
self.allow_in,
self.allow_yield,
self.allow_await,
)
.parse(cursor, interner)?;
let then_clause =
AssignmentExpression::new(None, true, self.allow_yield, self.allow_await)
.parse(cursor, interner)?;
cursor.expect(Punctuator::Colon, "conditional expression", interner)?;
let else_clause = AssignmentExpression::new(

Loading…
Cancel
Save