mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +00:00
LibJS/Parser: Parse logical expressions
This commit is contained in:
parent
94088640f1
commit
419d57e492
1 changed files with 6 additions and 0 deletions
|
@ -348,6 +348,12 @@ NonnullOwnPtr<Expression> Parser::parse_secondary_expression(NonnullOwnPtr<Expre
|
|||
case TokenType::MinusMinus:
|
||||
consume();
|
||||
return make<UpdateExpression>(UpdateOp::Decrement, move(lhs));
|
||||
case TokenType::DoubleAmpersand:
|
||||
consume();
|
||||
return make<LogicalExpression>(LogicalOp::And, move(lhs), parse_expression(min_precedence, associativity));
|
||||
case TokenType::DoublePipe:
|
||||
consume();
|
||||
return make<LogicalExpression>(LogicalOp::Or, move(lhs), parse_expression(min_precedence, associativity));
|
||||
default:
|
||||
m_has_errors = true;
|
||||
expected("secondary expression (missing switch case)");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue