1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:47:44 +00:00

LibJS: Convert resolve_this_binding() to ThrowCompletionOr

Also add spec comments.
This commit is contained in:
davidot 2021-12-30 23:00:37 +01:00 committed by Linus Groh
parent dc03529ffd
commit a24df37713
4 changed files with 13 additions and 5 deletions

View file

@ -503,10 +503,12 @@ void VM::throw_exception(Exception& exception)
}
// 9.4.4 ResolveThisBinding ( ), https://tc39.es/ecma262/#sec-resolvethisbinding
Value VM::resolve_this_binding(GlobalObject& global_object)
ThrowCompletionOr<Value> VM::resolve_this_binding(GlobalObject& global_object)
{
// 1. Let envRec be GetThisEnvironment().
auto& environment = get_this_environment(*this);
return TRY_OR_DISCARD(environment.get_this_binding(global_object));
// 2. Return ? envRec.GetThisBinding().
return TRY(environment.get_this_binding(global_object));
}
String VM::join_arguments(size_t start_index) const