mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-16 15:21:56 +00:00
LibJS: Implement bitwise unsigned right shift operator (>>>)
This commit is contained in:
parent
502d1f5165
commit
396ecfa2d7
Notes:
sideshowbarker
2024-07-19 07:21:35 +09:00
Author: https://github.com/linusg
Commit: 396ecfa2d7
Pull-request: https://github.com/SerenityOS/serenity/pull/1931
Reviewed-by: https://github.com/awesomekling
6 changed files with 108 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Stephan Unverwerth <s.unverwerth@gmx.de>
|
||||
* Copyright (c) 2020, Linus Groh <mail@linusgroh.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -589,6 +590,12 @@ NonnullRefPtr<Expression> Parser::parse_secondary_expression(NonnullRefPtr<Expre
|
|||
case TokenType::ShiftRightEquals:
|
||||
consume();
|
||||
return create_ast_node<AssignmentExpression>(AssignmentOp::RightShiftAssignment, move(lhs), parse_expression(min_precedence, associativity));
|
||||
case TokenType::UnsignedShiftRight:
|
||||
consume();
|
||||
return create_ast_node<BinaryExpression>(BinaryOp::UnsignedRightShift, move(lhs), parse_expression(min_precedence, associativity));
|
||||
case TokenType::UnsignedShiftRightEquals:
|
||||
consume();
|
||||
return create_ast_node<AssignmentExpression>(AssignmentOp::UnsignedRightShiftAssignment, move(lhs), parse_expression(min_precedence, associativity));
|
||||
case TokenType::ParenOpen:
|
||||
return parse_call_expression(move(lhs));
|
||||
case TokenType::Equals:
|
||||
|
@ -1078,6 +1085,8 @@ bool Parser::match_secondary_expression() const
|
|||
|| type == TokenType::ShiftLeftEquals
|
||||
|| type == TokenType::ShiftRight
|
||||
|| type == TokenType::ShiftRightEquals
|
||||
|| type == TokenType::UnsignedShiftRight
|
||||
|| type == TokenType::UnsignedShiftRightEquals
|
||||
|| type == TokenType::DoubleAmpersand
|
||||
|| type == TokenType::DoublePipe
|
||||
|| type == TokenType::DoubleQuestionMark;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue