summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-12-13 20:49:51 +0000
committerLinus Groh <mail@linusgroh.de>2022-12-14 09:59:45 +0000
commitb90f50540941bf87b6ec995133b8de8f44f9ce5f (patch)
treeeee831088b38b3e4b98d817ab7244723761bddf4 /Userland/Libraries
parent54ebf71da26bccd5ddd07fa5269d828d4ad19b34 (diff)
downloadserenity-b90f50540941bf87b6ec995133b8de8f44f9ce5f.zip
LibJS: Convert WrappedFunction::create() to NonnullGCPtr
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/Runtime/WrappedFunction.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/WrappedFunction.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/WrappedFunction.cpp b/Userland/Libraries/LibJS/Runtime/WrappedFunction.cpp
index 31d020511d..3400c5a489 100644
--- a/Userland/Libraries/LibJS/Runtime/WrappedFunction.cpp
+++ b/Userland/Libraries/LibJS/Runtime/WrappedFunction.cpp
@@ -11,7 +11,7 @@
namespace JS {
// 3.1.1 WrappedFunctionCreate ( callerRealm: a Realm Record, Target: a function object, ), https://tc39.es/proposal-shadowrealm/#sec-wrappedfunctioncreate
-ThrowCompletionOr<WrappedFunction*> WrappedFunction::create(Realm& realm, Realm& caller_realm, FunctionObject& target)
+ThrowCompletionOr<NonnullGCPtr<WrappedFunction>> WrappedFunction::create(Realm& realm, Realm& caller_realm, FunctionObject& target)
{
auto& vm = realm.vm();
@@ -32,7 +32,7 @@ ThrowCompletionOr<WrappedFunction*> WrappedFunction::create(Realm& realm, Realm&
return vm.throw_completion<TypeError>(ErrorType::WrappedFunctionCopyNameAndLengthThrowCompletion);
// 9. Return wrapped.
- return wrapped;
+ return NonnullGCPtr { *wrapped };
}
// 2 Wrapped Function Exotic Objects, https://tc39.es/proposal-shadowrealm/#sec-wrapped-function-exotic-objects
diff --git a/Userland/Libraries/LibJS/Runtime/WrappedFunction.h b/Userland/Libraries/LibJS/Runtime/WrappedFunction.h
index 4cc6c98d86..555835327d 100644
--- a/Userland/Libraries/LibJS/Runtime/WrappedFunction.h
+++ b/Userland/Libraries/LibJS/Runtime/WrappedFunction.h
@@ -15,7 +15,7 @@ class WrappedFunction final : public FunctionObject {
JS_OBJECT(WrappedFunction, FunctionObject);
public:
- static ThrowCompletionOr<WrappedFunction*> create(Realm&, Realm& caller_realm, FunctionObject& target_function);
+ static ThrowCompletionOr<NonnullGCPtr<WrappedFunction>> create(Realm&, Realm& caller_realm, FunctionObject& target_function);
virtual ~WrappedFunction() = default;