Skip to content

Commit

Permalink
Fix postfix operator line terminator parsing (#2520)
Browse files Browse the repository at this point in the history
Postfix increment / decrement operators require that there is no line terminator between the LHS expression and  the operator. This was previously ignored.
  • Loading branch information
raskad committed Jan 7, 2023
1 parent 3d5deba commit 1dcd932
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions boa_parser/src/parser/expression/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ where
let lhs = LeftHandSideExpression::new(self.name, self.allow_yield, self.allow_await)
.parse(cursor, interner)?;

if cursor.peek_is_line_terminator(0, interner)?.unwrap_or(true) {
return Ok(lhs);
}

if let Some(tok) = cursor.peek(0, interner)? {
let token_start = tok.span().start();
match tok.kind() {
Expand Down

0 comments on commit 1dcd932

Please sign in to comment.