From c132064ee9976d007bffb592ea8be19dd8584fb0 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 15 Dec 2022 20:04:26 +0000 Subject: [PATCH] LibJS: Convert new_private_environment() to NonnullGCPtr --- Userland/Libraries/LibJS/AST.cpp | 2 +- Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp | 2 +- Userland/Libraries/LibJS/Runtime/AbstractOperations.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index 099b21d9c7e..17ed5936e5a 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -1852,7 +1852,7 @@ ThrowCompletionOr ClassExpression::class_definition_e MUST(class_environment->create_immutable_binding(vm, binding_name, true)); auto* outer_private_environment = vm.running_execution_context().private_environment; - auto* class_private_environment = new_private_environment(vm, outer_private_environment); + auto class_private_environment = new_private_environment(vm, outer_private_environment); for (auto const& element : m_elements) { auto opt_private_name = element.private_bound_identifier(); diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp index e84438ac509..f24e6cc3f6f 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp @@ -435,7 +435,7 @@ NonnullGCPtr new_function_environment(ECMAScriptFunctionObj } // 9.2.1.1 NewPrivateEnvironment ( outerPrivEnv ), https://tc39.es/ecma262/#sec-newprivateenvironment -PrivateEnvironment* new_private_environment(VM& vm, PrivateEnvironment* outer) +NonnullGCPtr new_private_environment(VM& vm, PrivateEnvironment* outer) { // 1. Let names be a new empty List. // 2. Return the PrivateEnvironment Record { [[OuterPrivateEnvironment]]: outerPrivEnv, [[Names]]: names }. diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/AbstractOperations.h index 35daaf4a6c7..5d300573970 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.h +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.h @@ -22,7 +22,7 @@ namespace JS { NonnullGCPtr new_declarative_environment(Environment&); NonnullGCPtr new_object_environment(Object&, bool is_with_environment, Environment*); NonnullGCPtr new_function_environment(ECMAScriptFunctionObject&, Object* new_target); -PrivateEnvironment* new_private_environment(VM& vm, PrivateEnvironment* outer); +NonnullGCPtr new_private_environment(VM& vm, PrivateEnvironment* outer); Environment& get_this_environment(VM&); bool can_be_held_weakly(Value); Object* get_super_constructor(VM&);