LibJS: Add spec comments to Value::invoke_internal()
This commit is contained in:
parent
14e5003ece
commit
78895984e9
Notes:
sideshowbarker
2024-07-17 03:30:19 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/78895984e9 Pull-request: https://github.com/SerenityOS/serenity/pull/16405 Reviewed-by: https://github.com/davidot ✅
1 changed files with 6 additions and 4 deletions
|
@ -2455,11 +2455,13 @@ ThrowCompletionOr<TriState> is_less_than(VM& vm, Value lhs, Value rhs, bool left
|
|||
// 7.3.21 Invoke ( V, P [ , argumentsList ] ), https://tc39.es/ecma262/#sec-invoke
|
||||
ThrowCompletionOr<Value> Value::invoke_internal(VM& vm, PropertyKey const& property_key, Optional<MarkedVector<Value>> arguments)
|
||||
{
|
||||
auto property = TRY(get(vm, property_key));
|
||||
if (!property.is_function())
|
||||
return vm.throw_completion<TypeError>(ErrorType::NotAFunction, property.to_string_without_side_effects());
|
||||
// 1. If argumentsList is not present, set argumentsList to a new empty List.
|
||||
|
||||
return call(vm, property.as_function(), *this, move(arguments));
|
||||
// 2. Let func be ? GetV(V, P).
|
||||
auto function = TRY(get(vm, property_key));
|
||||
|
||||
// 3. Return ? Call(func, V, argumentsList).
|
||||
return call(vm, function, *this, move(arguments));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue