summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-12-13 20:49:50 +0000
committerLinus Groh <mail@linusgroh.de>2022-12-14 09:59:45 +0000
commit83de01043f210530dabbd9e0e92b878af19d757f (patch)
treed9448294176d60598bf6279499dc6b57e0d2eb67 /Userland/Libraries
parentd21ac9d820e18bca0e46164d93381467ec2eab5e (diff)
downloadserenity-83de01043f210530dabbd9e0e92b878af19d757f.zip
LibJS: Convert GeneratorObject::create() to NonnullGCPtr
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/GeneratorObject.h2
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*> GeneratorObject::create(Realm& realm, Value initial_value, ECMAScriptFunctionObject* generating_function, ExecutionContext execution_context, Bytecode::RegisterWindow frame)
+ThrowCompletionOr<NonnullGCPtr<GeneratorObject>> 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*> 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<GeneratorObject*> create(Realm&, Value, ECMAScriptFunctionObject*, ExecutionContext, Bytecode::RegisterWindow);
+ static ThrowCompletionOr<NonnullGCPtr<GeneratorObject>> create(Realm&, Value, ECMAScriptFunctionObject*, ExecutionContext, Bytecode::RegisterWindow);
virtual void initialize(Realm&) override;
virtual ~GeneratorObject() override = default;
void visit_edges(Cell::Visitor&) override;