1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:47:34 +00:00

LibJS: Remove home object from DeclarativeEnvironmentRecord

According to the spec, [[HomeObject]] is an internal slot on function
objects, and should always be accessed through there.
This commit is contained in:
Andreas Kling 2021-06-22 11:40:16 +02:00
parent 49340f98f7
commit 6ed6434bab
3 changed files with 7 additions and 14 deletions

View file

@ -50,7 +50,6 @@ void DeclarativeEnvironmentRecord::visit_edges(Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_this_value);
visitor.visit(m_home_object);
visitor.visit(m_new_target);
visitor.visit(m_current_function);
for (auto& it : m_variables)
@ -72,17 +71,15 @@ bool DeclarativeEnvironmentRecord::delete_from_environment_record(FlyString cons
return m_variables.remove(name);
}
bool DeclarativeEnvironmentRecord::has_super_binding() const
{
return m_environment_record_type == EnvironmentRecordType::Function && this_binding_status() != ThisBindingStatus::Lexical && m_home_object.is_object();
}
Value DeclarativeEnvironmentRecord::get_super_base()
{
VERIFY(has_super_binding());
if (m_home_object.is_object())
return m_home_object.as_object().prototype();
return {};
if (m_environment_record_type != EnvironmentRecordType::Function)
return {};
VERIFY(m_current_function);
auto home_object = m_current_function->home_object();
if (!home_object.is_object())
return {};
return home_object.as_object().prototype();
}
bool DeclarativeEnvironmentRecord::has_this_binding() const