summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-06-26 10:34:55 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-26 10:34:55 +0200
commit0f9038b732a6e0f5830e5e95c0b2a1c78efea415 (patch)
tree70f150b3ec94d114a8d519a06be7e2b5ba12b67b /Userland/Libraries
parent6d7d8f3db97ab309a6be57893302eef7c7c59b98 (diff)
downloadserenity-0f9038b732a6e0f5830e5e95c0b2a1c78efea415.zip
LibJS: Remove unnecessary GlobalObject& member on global environment
We already store the GlobalObject& in a base class, so no need to also store it in the subclass. :^)
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/Runtime/GlobalEnvironmentRecord.cpp7
-rw-r--r--Userland/Libraries/LibJS/Runtime/GlobalEnvironmentRecord.h2
2 files changed, 3 insertions, 6 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/GlobalEnvironmentRecord.cpp b/Userland/Libraries/LibJS/Runtime/GlobalEnvironmentRecord.cpp
index d233052aaf..5b803020c3 100644
--- a/Userland/Libraries/LibJS/Runtime/GlobalEnvironmentRecord.cpp
+++ b/Userland/Libraries/LibJS/Runtime/GlobalEnvironmentRecord.cpp
@@ -14,7 +14,6 @@ namespace JS {
GlobalEnvironmentRecord::GlobalEnvironmentRecord(GlobalObject& global_object)
: EnvironmentRecord(nullptr)
- , m_global_object(global_object)
{
m_object_record = global_object.heap().allocate<ObjectEnvironmentRecord>(global_object, global_object, ObjectEnvironmentRecord::IsWithEnvironment::No, nullptr);
m_declarative_record = global_object.heap().allocate<DeclarativeEnvironmentRecord>(global_object);
@@ -47,12 +46,12 @@ bool GlobalEnvironmentRecord::delete_from_environment_record(FlyString const& na
Value GlobalEnvironmentRecord::get_this_binding(GlobalObject&) const
{
- return &m_global_object;
+ return &global_object();
}
Value GlobalEnvironmentRecord::global_this_value() const
{
- return &m_global_object;
+ return &global_object();
}
// 9.1.1.4.1 HasBinding ( N ), https://tc39.es/ecma262/#sec-global-environment-records-hasbinding-n
@@ -144,7 +143,7 @@ bool GlobalEnvironmentRecord::has_lexical_declaration(FlyString const& name) con
// 9.1.1.4.14 HasRestrictedGlobalProperty ( N ), https://tc39.es/ecma262/#sec-hasrestrictedglobalproperty
bool GlobalEnvironmentRecord::has_restricted_global_property(FlyString const& name) const
{
- auto existing_prop = m_global_object.get_own_property_descriptor(name);
+ auto existing_prop = m_object_record->object().get_own_property_descriptor(name);
if (!existing_prop.has_value() || existing_prop.value().value.is_undefined())
return false;
if (existing_prop.value().attributes.is_configurable())
diff --git a/Userland/Libraries/LibJS/Runtime/GlobalEnvironmentRecord.h b/Userland/Libraries/LibJS/Runtime/GlobalEnvironmentRecord.h
index 093a1ba57d..5444176b3b 100644
--- a/Userland/Libraries/LibJS/Runtime/GlobalEnvironmentRecord.h
+++ b/Userland/Libraries/LibJS/Runtime/GlobalEnvironmentRecord.h
@@ -50,8 +50,6 @@ private:
virtual bool is_global_environment_record() const override { return true; }
virtual void visit_edges(Visitor&) override;
- GlobalObject& m_global_object;
-
ObjectEnvironmentRecord* m_object_record { nullptr };
DeclarativeEnvironmentRecord* m_declarative_record { nullptr };