mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:17:45 +00:00
LibJS: Replace GlobalObject with VM in common AOs [Part 18/19]
This commit is contained in:
parent
7856886ed5
commit
25849f8a6d
95 changed files with 536 additions and 677 deletions
|
@ -39,16 +39,15 @@ ThrowCompletionOr<Value> WeakRefConstructor::call()
|
|||
ThrowCompletionOr<Object*> WeakRefConstructor::construct(FunctionObject& new_target)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& global_object = this->global_object();
|
||||
|
||||
auto target = vm.argument(0);
|
||||
if (!can_be_held_weakly(target))
|
||||
return vm.throw_completion<TypeError>(ErrorType::CannotBeHeldWeakly, target.to_string_without_side_effects());
|
||||
|
||||
if (target.is_object())
|
||||
return TRY(ordinary_create_from_constructor<WeakRef>(global_object, new_target, &GlobalObject::weak_ref_prototype, target.as_object()));
|
||||
return TRY(ordinary_create_from_constructor<WeakRef>(vm, new_target, &GlobalObject::weak_ref_prototype, target.as_object()));
|
||||
VERIFY(target.is_symbol());
|
||||
return TRY(ordinary_create_from_constructor<WeakRef>(global_object, new_target, &GlobalObject::weak_ref_prototype, target.as_symbol()));
|
||||
return TRY(ordinary_create_from_constructor<WeakRef>(vm, new_target, &GlobalObject::weak_ref_prototype, target.as_symbol()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue