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. 8
      boa_engine/src/syntax/parser/expression/assignment/conditional.rs

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

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

Loading…
Cancel
Save