mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibJS: Convert Object::construct() to NonnullGCPtr
This commit is contained in:
parent
03acbf0beb
commit
6ae79a84df
Notes:
sideshowbarker
2024-07-17 07:20:49 +09:00
Author: https://github.com/linusg
Commit: 6ae79a84df
Pull-request: https://github.com/SerenityOS/serenity/pull/16498
Reviewed-by: https://github.com/trflynn89 ✅
117 changed files with 216 additions and 216 deletions
|
@ -64,17 +64,17 @@ ThrowCompletionOr<Value> ObjectConstructor::call()
|
|||
}
|
||||
|
||||
// 20.1.1.1 Object ( [ value ] ), https://tc39.es/ecma262/#sec-object-value
|
||||
ThrowCompletionOr<Object*> ObjectConstructor::construct(FunctionObject& new_target)
|
||||
ThrowCompletionOr<NonnullGCPtr<Object>> ObjectConstructor::construct(FunctionObject& new_target)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
if (&new_target != this)
|
||||
return TRY(ordinary_create_from_constructor<Object>(vm, new_target, &Intrinsics::object_prototype, ConstructWithPrototypeTag::Tag)).ptr();
|
||||
return TRY(ordinary_create_from_constructor<Object>(vm, new_target, &Intrinsics::object_prototype, ConstructWithPrototypeTag::Tag));
|
||||
auto value = vm.argument(0);
|
||||
if (value.is_nullish())
|
||||
return Object::create(realm, realm.intrinsics().object_prototype()).ptr();
|
||||
return value.to_object(vm);
|
||||
return Object::create(realm, realm.intrinsics().object_prototype());
|
||||
return *TRY(value.to_object(vm));
|
||||
}
|
||||
|
||||
enum class GetOwnPropertyKeysType {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue