From b11135cbc28e0c326fb804380b2d01ce1db3f5b4 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Fri, 9 Dec 2022 23:55:11 +0000 Subject: [PATCH] LibJS: Add spec comments to Value::is_function() --- Userland/Libraries/LibJS/Runtime/Value.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index c0cf4b1dff..3dcbc53722 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -241,6 +241,9 @@ Array& Value::as_array() // 7.2.3 IsCallable ( argument ), https://tc39.es/ecma262/#sec-iscallable bool Value::is_function() const { + // 1. If argument is not an Object, return false. + // 2. If argument has a [[Call]] internal method, return true. + // 3. Return false. return is_object() && as_object().is_function(); }