Explorar o código

LibJS: Add spec comments to FinalizationRegistryConstructor

Linus Groh %!s(int64=2) %!d(string=hai) anos
pai
achega
2473940526

+ 2 - 2
Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp

@@ -33,6 +33,8 @@ void FinalizationRegistryConstructor::initialize(Realm& realm)
 ThrowCompletionOr<Value> FinalizationRegistryConstructor::call()
 {
     auto& vm = this->vm();
+
+    // 1. If NewTarget is undefined, throw a TypeError exception.
     return vm.throw_completion<TypeError>(ErrorType::ConstructorWithoutNew, vm.names.FinalizationRegistry);
 }
 
@@ -41,8 +43,6 @@ ThrowCompletionOr<NonnullGCPtr<Object>> FinalizationRegistryConstructor::constru
 {
     auto& vm = this->vm();
 
-    // NOTE: Step 1 is implemented in FinalizationRegistryConstructor::call()
-
     // 2. If IsCallable(cleanupCallback) is false, throw a TypeError exception.
     auto cleanup_callback = vm.argument(0);
     if (!cleanup_callback.is_function())