mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 19:29:16 +00:00
LibJS: Implement bitwise assignment operators (&=, |=, ^=)
This commit is contained in:
committed by
Andreas Kling
parent
8e4301dea6
commit
3e754a15d4
@@ -850,6 +850,24 @@ Value AssignmentExpression::execute(Interpreter& interpreter) const
|
||||
return {};
|
||||
rhs_result = div(interpreter, lhs_result, rhs_result);
|
||||
break;
|
||||
case AssignmentOp::BitwiseAndAssignment:
|
||||
lhs_result = m_lhs->execute(interpreter);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
rhs_result = bitwise_and(interpreter, lhs_result, rhs_result);
|
||||
break;
|
||||
case AssignmentOp::BitwiseOrAssignment:
|
||||
lhs_result = m_lhs->execute(interpreter);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
rhs_result = bitwise_or(interpreter, lhs_result, rhs_result);
|
||||
break;
|
||||
case AssignmentOp::BitwiseXorAssignment:
|
||||
lhs_result = m_lhs->execute(interpreter);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
rhs_result = bitwise_xor(interpreter, lhs_result, rhs_result);
|
||||
break;
|
||||
case AssignmentOp::LeftShiftAssignment:
|
||||
lhs_result = m_lhs->execute(interpreter);
|
||||
if (interpreter.exception())
|
||||
@@ -936,6 +954,15 @@ void AssignmentExpression::dump(int indent) const
|
||||
case AssignmentOp::DivisionAssignment:
|
||||
op_string = "/=";
|
||||
break;
|
||||
case AssignmentOp::BitwiseAndAssignment:
|
||||
op_string = "&=";
|
||||
break;
|
||||
case AssignmentOp::BitwiseOrAssignment:
|
||||
op_string = "|=";
|
||||
break;
|
||||
case AssignmentOp::BitwiseXorAssignment:
|
||||
op_string = "^=";
|
||||
break;
|
||||
case AssignmentOp::LeftShiftAssignment:
|
||||
op_string = "<<=";
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user