mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
LibJS: Convert get_this_binding() to ThrowCompletionOr
Also add spec step comments to it while we're here.
This commit is contained in:
parent
4f03138971
commit
0aa24f4ce5
8 changed files with 21 additions and 16 deletions
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <LibJS/AST.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/DeclarativeEnvironment.h>
|
||||
#include <LibJS/Runtime/GlobalEnvironment.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
|
@ -30,9 +31,11 @@ void GlobalEnvironment::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_declarative_record);
|
||||
}
|
||||
|
||||
Value GlobalEnvironment::get_this_binding(GlobalObject&) const
|
||||
// 9.1.1.4.11 GetThisBinding ( ), https://tc39.es/ecma262/#sec-global-environment-records-getthisbinding
|
||||
ThrowCompletionOr<Value> GlobalEnvironment::get_this_binding(GlobalObject&) const
|
||||
{
|
||||
return m_global_this_value;
|
||||
// 1. Return envRec.[[GlobalThisValue]].
|
||||
return { m_global_this_value };
|
||||
}
|
||||
|
||||
// 9.1.1.4.1 HasBinding ( N ), https://tc39.es/ecma262/#sec-global-environment-records-hasbinding-n
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue