1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:37:44 +00:00

LibJS: Rename ExecutionContext::callee => function

This matches what ECMAScript calls it. Also make it a JS::Function*
instead of a generic Value, since it will always either be a function
object or null.
This commit is contained in:
Andreas Kling 2021-06-24 19:25:38 +02:00
parent c2ad599783
commit 6215a9c2cb
2 changed files with 5 additions and 5 deletions

View file

@ -358,7 +358,7 @@ Value VM::get_variable(const FlyString& name, GlobalObject& global_object)
{
if (!m_execution_context_stack.is_empty()) {
auto& context = running_execution_context();
if (name == names.arguments.as_string() && context.callee) {
if (name == names.arguments.as_string() && context.function) {
// HACK: Special handling for the name "arguments":
// If the name "arguments" is defined in the current scope, for example via
// a function parameter, or by a local var declaration, we use that.
@ -369,7 +369,7 @@ Value VM::get_variable(const FlyString& name, GlobalObject& global_object)
return possible_match.value().value;
if (!context.arguments_object) {
context.arguments_object = Array::create(global_object);
context.arguments_object->put(names.callee, context.callee);
context.arguments_object->put(names.callee, context.function);
for (auto argument : context.arguments) {
context.arguments_object->indexed_properties().append(argument);
}
@ -405,7 +405,7 @@ Value VM::construct(Function& function, Function& new_target, Optional<MarkedVal
{
auto& global_object = function.global_object();
ExecutionContext execution_context;
execution_context.callee = &function;
execution_context.function = &function;
if (auto* interpreter = interpreter_if_exists())
execution_context.current_node = interpreter->current_node();
execution_context.is_strict_mode = function.is_strict_mode();
@ -511,7 +511,7 @@ Value VM::call_internal(Function& function, Value this_value, Optional<MarkedVal
VERIFY(!this_value.is_empty());
ExecutionContext execution_context;
execution_context.callee = &function;
execution_context.function = &function;
if (auto* interpreter = interpreter_if_exists())
execution_context.current_node = interpreter->current_node();
execution_context.is_strict_mode = function.is_strict_mode();