summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/AST.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-04-05 13:40:00 +0100
committerAndreas Kling <kling@serenityos.org>2020-04-05 15:32:06 +0200
commit0403845d3edce9caf6823e0579074f57e9a4b9b9 (patch)
treef545e5cc2f4be20bd90d696174090e333077512c /Libraries/LibJS/AST.cpp
parenteafd3dbaf88461ba7fb99ce8c5c6e7a295bed9b4 (diff)
downloadserenity-0403845d3edce9caf6823e0579074f57e9a4b9b9.zip
LibJS: Implement exponentiation (** operator)
Diffstat (limited to 'Libraries/LibJS/AST.cpp')
-rw-r--r--Libraries/LibJS/AST.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp
index 5a7f8cc152..8bd75e4a90 100644
--- a/Libraries/LibJS/AST.cpp
+++ b/Libraries/LibJS/AST.cpp
@@ -283,6 +283,8 @@ Value BinaryExpression::execute(Interpreter& interpreter) const
return div(lhs_result, rhs_result);
case BinaryOp::Modulo:
return mod(lhs_result, rhs_result);
+ case BinaryOp::Exponentiation:
+ return exp(lhs_result, rhs_result);
case BinaryOp::TypedEquals:
return typed_eq(lhs_result, rhs_result);
case BinaryOp::TypedInequals:
@@ -421,6 +423,9 @@ void BinaryExpression::dump(int indent) const
case BinaryOp::Modulo:
op_string = "%";
break;
+ case BinaryOp::Exponentiation:
+ op_string = "**";
+ break;
case BinaryOp::TypedEquals:
op_string = "===";
break;