瀏覽代碼

LibJS: Add spec comments to FinalizationRegistryConstructor

Linus Groh 2 年之前
父節點
當前提交
2473940526
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp

+ 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())