mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 18:37:36 +00:00
LibJS: Convert resolve_this_binding() to ThrowCompletionOr
Also add spec comments.
This commit is contained in:
parent
dc03529ffd
commit
a24df37713
4 changed files with 13 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -155,7 +155,7 @@ public:
|
|||
return running_execution_context().this_value;
|
||||
}
|
||||
|
||||
Value resolve_this_binding(GlobalObject&);
|
||||
ThrowCompletionOr<Value> resolve_this_binding(GlobalObject&);
|
||||
|
||||
Value last_value() const { return m_last_value; }
|
||||
void set_last_value(Badge<Bytecode::Interpreter>, Value value) { m_last_value = value; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue