mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibJS/Parser: Parse logical expressions
This commit is contained in:
parent
94088640f1
commit
419d57e492
Notes:
sideshowbarker
2024-07-19 08:16:52 +09:00
Author: https://github.com/0xtechnobabble Commit: https://github.com/SerenityOS/serenity/commit/419d57e492b Pull-request: https://github.com/SerenityOS/serenity/pull/1470 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/oriko1010
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…
Reference in a new issue