Skip to content

Commit

Permalink
Allow UnaryExpression with prefix increment/decrement (#844)
Browse files Browse the repository at this point in the history
  • Loading branch information
croraf authored Oct 11, 2020
1 parent 8aef556 commit 210a9ec
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions boa/src/syntax/parser/expression/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ use crate::{
syntax::{
ast::{node, op::UnaryOp, Node, Punctuator},
lexer::TokenKind,
parser::{AllowAwait, AllowYield, Cursor, ParseError, ParseResult, TokenParser},
parser::{
expression::unary::UnaryExpression, AllowAwait, AllowYield, Cursor, ParseError,
ParseResult, TokenParser,
},
},
};

Expand Down Expand Up @@ -58,17 +61,15 @@ where
cursor.next()?.expect("Punctuator::Inc token disappeared");
return Ok(node::UnaryOp::new(
UnaryOp::IncrementPre,
LeftHandSideExpression::new(self.allow_yield, self.allow_await)
.parse(cursor)?,
UnaryExpression::new(self.allow_yield, self.allow_await).parse(cursor)?,
)
.into());
}
TokenKind::Punctuator(Punctuator::Dec) => {
cursor.next()?.expect("Punctuator::Dec token disappeared");
return Ok(node::UnaryOp::new(
UnaryOp::DecrementPre,
LeftHandSideExpression::new(self.allow_yield, self.allow_await)
.parse(cursor)?,
UnaryExpression::new(self.allow_yield, self.allow_await).parse(cursor)?,
)
.into());
}
Expand Down

0 comments on commit 210a9ec

Please sign in to comment.