From 83de01043f210530dabbd9e0e92b878af19d757f Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 13 Dec 2022 20:49:50 +0000 Subject: [PATCH] LibJS: Convert GeneratorObject::create() to NonnullGCPtr --- Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp | 4 ++-- Userland/Libraries/LibJS/Runtime/GeneratorObject.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp b/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp index b1dacaf2d0..cb80bc8083 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp @@ -14,7 +14,7 @@ namespace JS { -ThrowCompletionOr GeneratorObject::create(Realm& realm, Value initial_value, ECMAScriptFunctionObject* generating_function, ExecutionContext execution_context, Bytecode::RegisterWindow frame) +ThrowCompletionOr> GeneratorObject::create(Realm& realm, Value initial_value, ECMAScriptFunctionObject* generating_function, ExecutionContext execution_context, Bytecode::RegisterWindow frame) { auto& vm = realm.vm(); // This is "g1.prototype" in figure-2 (https://tc39.es/ecma262/img/figure-2.png) @@ -32,7 +32,7 @@ ThrowCompletionOr GeneratorObject::create(Realm& realm, Value object->m_generating_function = generating_function; object->m_frame = move(frame); object->m_previous_value = initial_value; - return object; + return NonnullGCPtr { *object }; } GeneratorObject::GeneratorObject(Realm&, Object& prototype, ExecutionContext context) diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorObject.h b/Userland/Libraries/LibJS/Runtime/GeneratorObject.h index 9769256776..2a2f790e9a 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorObject.h +++ b/Userland/Libraries/LibJS/Runtime/GeneratorObject.h @@ -16,7 +16,7 @@ class GeneratorObject final : public Object { JS_OBJECT(GeneratorObject, Object); public: - static ThrowCompletionOr create(Realm&, Value, ECMAScriptFunctionObject*, ExecutionContext, Bytecode::RegisterWindow); + static ThrowCompletionOr> create(Realm&, Value, ECMAScriptFunctionObject*, ExecutionContext, Bytecode::RegisterWindow); virtual void initialize(Realm&) override; virtual ~GeneratorObject() override = default; void visit_edges(Cell::Visitor&) override;