mirror of
https://github.com/RGBCube/serenity
synced 2025-06-30 03:12:12 +00:00
LibJS: Implement bitwise assignment operators (&=, |=, ^=)
This commit is contained in:
parent
8e4301dea6
commit
3e754a15d4
8 changed files with 62 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue