1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:07:36 +00:00

LibJS: Convert Realm::create() to NonnullGCPtr

This commit is contained in:
Linus Groh 2022-12-13 20:49:50 +00:00
parent e0818bf21e
commit bfb8d83535
4 changed files with 6 additions and 7 deletions

View file

@ -15,7 +15,7 @@
namespace JS {
// 9.3.1 CreateRealm ( ), https://tc39.es/ecma262/#sec-createrealm
Realm* Realm::create(VM& vm)
NonnullGCPtr<Realm> Realm::create(VM& vm)
{
// 1. Let realmRec be a new Realm Record.
auto* realm = vm.heap().allocate_without_realm<Realm>();
@ -28,7 +28,7 @@ Realm* Realm::create(VM& vm)
// 5. Set realmRec.[[TemplateMap]] to a new empty List.
// 6. Return realmRec.
return realm;
return *realm;
}
// 9.6 InitializeHostDefinedRealm ( ), https://tc39.es/ecma262/#sec-initializehostdefinedrealm
@ -37,7 +37,7 @@ ThrowCompletionOr<NonnullOwnPtr<ExecutionContext>> Realm::initialize_host_define
DeferGC defer_gc(vm.heap());
// 1. Let realm be CreateRealm().
auto* realm = Realm::create(vm);
auto realm = Realm::create(vm);
// 2. Let newContext be a new execution context.
auto new_context = make<ExecutionContext>(vm.heap());