LibJS: Convert WrappedFunction::create() to NonnullGCPtr

This commit is contained in:
Linus Groh 2022-12-13 20:49:51 +00:00
parent 54ebf71da2
commit b90f505409
Notes: sideshowbarker 2024-07-19 01:59:31 +09:00
2 changed files with 3 additions and 3 deletions

View file

@ -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

View file

@ -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;