mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 23:58:11 +00:00
LibJS: Replace GlobalObject with VM in Environment AOs [Part 5/19]
This commit is contained in:
parent
a022e548b8
commit
275a7a0c0a
22 changed files with 222 additions and 205 deletions
|
@ -61,21 +61,21 @@ bool FunctionEnvironment::has_super_binding() const
|
|||
}
|
||||
|
||||
// 9.1.1.3.4 GetThisBinding ( ), https://tc39.es/ecma262/#sec-function-environment-records-getthisbinding
|
||||
ThrowCompletionOr<Value> FunctionEnvironment::get_this_binding(GlobalObject&) const
|
||||
ThrowCompletionOr<Value> FunctionEnvironment::get_this_binding(VM& vm) const
|
||||
{
|
||||
// 1. Assert: envRec.[[ThisBindingStatus]] is not lexical.
|
||||
VERIFY(m_this_binding_status != ThisBindingStatus::Lexical);
|
||||
|
||||
// 2. If envRec.[[ThisBindingStatus]] is uninitialized, throw a ReferenceError exception.
|
||||
if (m_this_binding_status == ThisBindingStatus::Uninitialized)
|
||||
return vm().throw_completion<ReferenceError>(ErrorType::ThisHasNotBeenInitialized);
|
||||
return vm.throw_completion<ReferenceError>(ErrorType::ThisHasNotBeenInitialized);
|
||||
|
||||
// 3. Return envRec.[[ThisValue]].
|
||||
return m_this_value;
|
||||
}
|
||||
|
||||
// 9.1.1.3.1 BindThisValue ( V ), https://tc39.es/ecma262/#sec-bindthisvalue
|
||||
ThrowCompletionOr<Value> FunctionEnvironment::bind_this_value(GlobalObject&, Value this_value)
|
||||
ThrowCompletionOr<Value> FunctionEnvironment::bind_this_value(VM& vm, Value this_value)
|
||||
{
|
||||
VERIFY(!this_value.is_empty());
|
||||
|
||||
|
@ -84,7 +84,7 @@ ThrowCompletionOr<Value> FunctionEnvironment::bind_this_value(GlobalObject&, Val
|
|||
|
||||
// 2. If envRec.[[ThisBindingStatus]] is initialized, throw a ReferenceError exception.
|
||||
if (m_this_binding_status == ThisBindingStatus::Initialized)
|
||||
return vm().throw_completion<ReferenceError>(ErrorType::ThisIsAlreadyInitialized);
|
||||
return vm.throw_completion<ReferenceError>(ErrorType::ThisIsAlreadyInitialized);
|
||||
|
||||
// 3. Set envRec.[[ThisValue]] to V.
|
||||
m_this_value = this_value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue