1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:57:46 +00:00

LibJS: Align ObjectEnvironmentRecord member names with the spec

In the spec, object environments have a [[BindingObject]], so let's
call it the same thing in our implementation.
This commit is contained in:
Andreas Kling 2021-06-26 10:38:36 +02:00
parent 0f9038b732
commit ee4fc97038
3 changed files with 32 additions and 30 deletions

View file

@ -18,7 +18,7 @@ public:
No,
Yes,
};
ObjectEnvironmentRecord(Object&, IsWithEnvironment, EnvironmentRecord* parent_scope);
ObjectEnvironmentRecord(Object& binding_object, IsWithEnvironment, EnvironmentRecord* outer_environment);
virtual Optional<Variable> get_from_environment_record(FlyString const&) const override;
virtual void put_into_environment_record(FlyString const&, Variable) override;
@ -36,18 +36,20 @@ public:
virtual Object* with_base_object() const override
{
if (is_with_environment())
return &m_object;
return &m_binding_object;
return nullptr;
}
bool is_with_environment() const { return m_with_environment; }
// [[BindingObject]], The binding object of this Environment Record.
Object& binding_object() { return m_binding_object; }
Object& object() { return m_object; }
// [[IsWithEnvironment]], Indicates whether this Environment Record is created for a with statement.
bool is_with_environment() const { return m_with_environment; }
private:
virtual void visit_edges(Visitor&) override;
Object& m_object;
Object& m_binding_object;
bool m_with_environment { false };
};