Explorar o código

LibJS: Convert WeakRefPrototype functions to ThrowCompletionOr

Idan Horowitz %!s(int64=3) %!d(string=hai) anos
pai
achega
c815519a65

+ 3 - 3
Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp

@@ -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();

+ 1 - 1
Userland/Libraries/LibJS/Runtime/WeakRefPrototype.h

@@ -20,7 +20,7 @@ public:
     virtual ~WeakRefPrototype() override;
     virtual ~WeakRefPrototype() override;
 
 
 private:
 private:
-    JS_DECLARE_OLD_NATIVE_FUNCTION(deref);
+    JS_DECLARE_NATIVE_FUNCTION(deref);
 };
 };
 
 
 }
 }