Explorar o código

LibJS: Add spec comments to WeakRefPrototype

Linus Groh %!s(int64=2) %!d(string=hai) anos
pai
achega
77fc05afd6
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      Userland/Libraries/LibJS/Runtime/WeakRefPrototype.cpp

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

@@ -29,8 +29,11 @@ ThrowCompletionOr<void> WeakRefPrototype::initialize(Realm& realm)
 // 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_NATIVE_FUNCTION(WeakRefPrototype::deref)
 JS_DEFINE_NATIVE_FUNCTION(WeakRefPrototype::deref)
 {
 {
+    // 1. Let weakRef be the this value.
+    // 2. Perform ? RequireInternalSlot(weakRef, [[WeakRefTarget]]).
     auto* weak_ref = TRY(typed_this_object(vm));
     auto* weak_ref = TRY(typed_this_object(vm));
 
 
+    // 3. Return WeakRefDeref(weakRef).
     weak_ref->update_execution_generation();
     weak_ref->update_execution_generation();
     return weak_ref->value().visit(
     return weak_ref->value().visit(
         [](Empty) -> Value { return js_undefined(); },
         [](Empty) -> Value { return js_undefined(); },