From 1dcd932f1f2c203f0010456d1e8c2e3e4e0d008d Mon Sep 17 00:00:00 2001 From: raskad <32105367+raskad@users.noreply.github.com> Date: Sat, 7 Jan 2023 05:08:08 +0000 Subject: [PATCH] Fix postfix operator line terminator parsing (#2520) Postfix increment / decrement operators require that there is no line terminator between the LHS expression and the operator. This was previously ignored. --- boa_parser/src/parser/expression/update.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boa_parser/src/parser/expression/update.rs b/boa_parser/src/parser/expression/update.rs index 9f196fac3f1..d36f8aff2d5 100644 --- a/boa_parser/src/parser/expression/update.rs +++ b/boa_parser/src/parser/expression/update.rs @@ -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() {