mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 12:07:14 +02:00
LibJS: Convert Object::construct() to NonnullGCPtr
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 07:20:49 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/6ae79a84df Pull-request: https://github.com/SerenityOS/serenity/pull/16498 Reviewed-by: https://github.com/trflynn89 ✅
@@ -37,14 +37,14 @@ ThrowCompletionOr<Value> WeakMapConstructor::call()
|
||||
}
|
||||
|
||||
// 24.3.1.1 WeakMap ( [ iterable ] ), https://tc39.es/ecma262/#sec-weakmap-iterable
|
||||
ThrowCompletionOr<Object*> WeakMapConstructor::construct(FunctionObject& new_target)
|
||||
ThrowCompletionOr<NonnullGCPtr<Object>> WeakMapConstructor::construct(FunctionObject& new_target)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
auto weak_map = TRY(ordinary_create_from_constructor<WeakMap>(vm, new_target, &Intrinsics::weak_map_prototype));
|
||||
|
||||
if (vm.argument(0).is_nullish())
|
||||
return weak_map.ptr();
|
||||
return weak_map;
|
||||
|
||||
auto adder = TRY(weak_map->get(vm.names.set));
|
||||
if (!adder.is_function())
|
||||
@@ -61,7 +61,7 @@ ThrowCompletionOr<Object*> WeakMapConstructor::construct(FunctionObject& new_tar
|
||||
return {};
|
||||
}));
|
||||
|
||||
return weak_map.ptr();
|
||||
return weak_map;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user