diff options
author | Andreas Kling <kling@serenityos.org> | 2021-06-24 19:25:38 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-24 19:28:00 +0200 |
commit | 6215a9c2cbdfe0c631ed339e5266580d271a3882 (patch) | |
tree | b12d88eae44fa16124c7a41b1f95f57eab99cf75 /Userland/Libraries | |
parent | c2ad5997830b9b633efd3f6d5ef335ed6622b418 (diff) | |
download | serenity-6215a9c2cbdfe0c631ed339e5266580d271a3882.zip |
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.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/VM.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/VM.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index 2662943380..4a032b732f 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -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(); diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h index 4b568f7e65..b49d1468aa 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.h +++ b/Userland/Libraries/LibJS/Runtime/VM.h @@ -45,7 +45,7 @@ struct ScopeFrame { struct ExecutionContext { const ASTNode* current_node { nullptr }; FlyString function_name; - Value callee; + Function* function { nullptr }; Value this_value; Vector<Value> arguments; Array* arguments_object { nullptr }; |