Browse Source

Allow UnaryExpression with prefix increment/decrement (#844)

pull/849/head
croraf 4 years ago committed by GitHub
parent
commit
210a9ec285
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      boa/src/syntax/parser/expression/update.rs

11
boa/src/syntax/parser/expression/update.rs

@ -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,
},
},
};
@ -58,8 +61,7 @@ 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());
}
@ -67,8 +69,7 @@ where
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());
}

Loading…
Cancel
Save