mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:57:47 +00:00
LibJS: Convert WeakRefPrototype functions to ThrowCompletionOr
This commit is contained in:
parent
719d1b48ac
commit
c815519a65
2 changed files with 4 additions and 4 deletions
|
@ -19,7 +19,7 @@ void WeakRefPrototype::initialize(GlobalObject& global_object)
|
||||||
auto& vm = this->vm();
|
auto& vm = this->vm();
|
||||||
Object::initialize(global_object);
|
Object::initialize(global_object);
|
||||||
|
|
||||||
define_old_native_function(vm.names.deref, deref, 0, Attribute::Writable | Attribute::Configurable);
|
define_native_function(vm.names.deref, deref, 0, Attribute::Writable | Attribute::Configurable);
|
||||||
|
|
||||||
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.WeakRef.as_string()), Attribute::Configurable);
|
define_direct_property(*vm.well_known_symbol_to_string_tag(), js_string(vm, vm.names.WeakRef.as_string()), Attribute::Configurable);
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,9 @@ WeakRefPrototype::~WeakRefPrototype()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 26.1.3.2 WeakRef.prototype.deref ( ), https://tc39.es/ecma262/#sec-weak-ref.prototype.deref
|
// 26.1.3.2 WeakRef.prototype.deref ( ), https://tc39.es/ecma262/#sec-weak-ref.prototype.deref
|
||||||
JS_DEFINE_OLD_NATIVE_FUNCTION(WeakRefPrototype::deref)
|
JS_DEFINE_NATIVE_FUNCTION(WeakRefPrototype::deref)
|
||||||
{
|
{
|
||||||
auto* weak_ref = TRY_OR_DISCARD(typed_this_object(global_object));
|
auto* weak_ref = TRY(typed_this_object(global_object));
|
||||||
|
|
||||||
weak_ref->update_execution_generation();
|
weak_ref->update_execution_generation();
|
||||||
return weak_ref->value() ?: js_undefined();
|
return weak_ref->value() ?: js_undefined();
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
virtual ~WeakRefPrototype() override;
|
virtual ~WeakRefPrototype() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JS_DECLARE_OLD_NATIVE_FUNCTION(deref);
|
JS_DECLARE_NATIVE_FUNCTION(deref);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue