summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/Runtime/CommonPropertyNames.h1
-rw-r--r--Userland/Libraries/LibJS/Runtime/VM.cpp3
-rw-r--r--Userland/Libraries/LibJS/Runtime/VM.h1
3 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/CommonPropertyNames.h b/Userland/Libraries/LibJS/Runtime/CommonPropertyNames.h
index f77911048e..dbc332144a 100644
--- a/Userland/Libraries/LibJS/Runtime/CommonPropertyNames.h
+++ b/Userland/Libraries/LibJS/Runtime/CommonPropertyNames.h
@@ -75,6 +75,7 @@ namespace JS {
P(bind) \
P(byteLength) \
P(call) \
+ P(callee) \
P(cbrt) \
P(ceil) \
P(charAt) \
diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp
index fe83987150..afaeaefed2 100644
--- a/Userland/Libraries/LibJS/Runtime/VM.cpp
+++ b/Userland/Libraries/LibJS/Runtime/VM.cpp
@@ -175,6 +175,7 @@ Value VM::get_variable(const FlyString& name, GlobalObject& global_object)
return possible_match.value().value;
if (!call_frame().arguments_object) {
call_frame().arguments_object = Array::create(global_object);
+ call_frame().arguments_object->put(names.callee, call_frame().callee);
for (auto argument : call_frame().arguments) {
call_frame().arguments_object->indexed_properties().append(argument);
}
@@ -211,6 +212,7 @@ Reference VM::get_reference(const FlyString& name)
Value VM::construct(Function& function, Function& new_target, Optional<MarkedValueList> arguments, GlobalObject& global_object)
{
CallFrame call_frame;
+ call_frame.callee = &function;
call_frame.current_node = current_node();
call_frame.is_strict_mode = function.is_strict_mode();
@@ -335,6 +337,7 @@ Value VM::call_internal(Function& function, Value this_value, Optional<MarkedVal
VERIFY(!exception());
CallFrame call_frame;
+ call_frame.callee = &function;
call_frame.current_node = current_node();
call_frame.is_strict_mode = function.is_strict_mode();
call_frame.function_name = function.name();
diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h
index 7313e9301a..1dca17e66f 100644
--- a/Userland/Libraries/LibJS/Runtime/VM.h
+++ b/Userland/Libraries/LibJS/Runtime/VM.h
@@ -58,6 +58,7 @@ struct ScopeFrame {
struct CallFrame {
const ASTNode* current_node;
FlyString function_name;
+ Value callee;
Value this_value;
Vector<Value> arguments;
Array* arguments_object { nullptr };