LibJS: Implement exponentiation assignment operator (**=)

This commit is contained in:
Linus Groh 2020-05-04 23:03:35 +01:00 committed by Andreas Kling
commit a2e1f1a872
Notes: sideshowbarker 2024-07-19 06:57:56 +09:00
8 changed files with 23 additions and 5 deletions

View file

@ -850,6 +850,12 @@ Value AssignmentExpression::execute(Interpreter& interpreter) const
return {};
rhs_result = div(interpreter, lhs_result, rhs_result);
break;
case AssignmentOp::ExponentiationAssignment:
lhs_result = m_lhs->execute(interpreter);
if (interpreter.exception())
return {};
rhs_result = exp(interpreter, lhs_result, rhs_result);
break;
case AssignmentOp::BitwiseAndAssignment:
lhs_result = m_lhs->execute(interpreter);
if (interpreter.exception())
@ -954,6 +960,9 @@ void AssignmentExpression::dump(int indent) const
case AssignmentOp::DivisionAssignment:
op_string = "/=";
break;
case AssignmentOp::ExponentiationAssignment:
op_string = "**=";
break;
case AssignmentOp::BitwiseAndAssignment:
op_string = "&=";
break;