From 208be8b86d264c3487f92c8581ca80a183076ac5 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 15 Dec 2022 20:03:46 +0000 Subject: [PATCH] LibJS: Convert new_function_environment() to NonnullGCPtr --- Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp | 2 +- Userland/Libraries/LibJS/Runtime/AbstractOperations.h | 2 +- Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp index 088ca82ba93..e84438ac509 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp @@ -407,7 +407,7 @@ NonnullGCPtr new_object_environment(Object& object, bool is_w } // 9.1.2.4 NewFunctionEnvironment ( F, newTarget ), https://tc39.es/ecma262/#sec-newfunctionenvironment -FunctionEnvironment* new_function_environment(ECMAScriptFunctionObject& function, Object* new_target) +NonnullGCPtr new_function_environment(ECMAScriptFunctionObject& function, Object* new_target) { auto& heap = function.heap(); diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/AbstractOperations.h index 8c4be9617b6..35daaf4a6c7 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.h +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.h @@ -21,7 +21,7 @@ namespace JS { NonnullGCPtr new_declarative_environment(Environment&); NonnullGCPtr new_object_environment(Object&, bool is_with_environment, Environment*); -FunctionEnvironment* new_function_environment(ECMAScriptFunctionObject&, Object* new_target); +NonnullGCPtr new_function_environment(ECMAScriptFunctionObject&, Object* new_target); PrivateEnvironment* new_private_environment(VM& vm, PrivateEnvironment* outer); Environment& get_this_environment(VM&); bool can_be_held_weakly(Value); diff --git a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp index 9f1a7089bc1..a5a9cdfbbdf 100644 --- a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp @@ -622,7 +622,7 @@ ThrowCompletionOr ECMAScriptFunctionObject::prepare_for_ordinary_call(Exec callee_context.script_or_module = m_script_or_module; // 7. Let localEnv be NewFunctionEnvironment(F, newTarget). - auto* local_environment = new_function_environment(*this, new_target); + auto local_environment = new_function_environment(*this, new_target); // 8. Set the LexicalEnvironment of calleeContext to localEnv. callee_context.lexical_environment = local_environment;