mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-10 13:12:56 +00:00
Previously, EnvironmentRecord was a JS::Object. This was done because GlobalObject inherited from EnvironmentRecord. Now that this is no longer the case, we can simplify things by making EnvironmentRecord inherit from Cell directly. This also removes the need for environment records to have a shape, which was awkward. This will be removed in the following patch.
39 lines
1.4 KiB
C++
39 lines
1.4 KiB
C++
/*
|
|
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibJS/Runtime/EnvironmentRecord.h>
|
|
|
|
namespace JS {
|
|
|
|
class ObjectEnvironmentRecord : public EnvironmentRecord {
|
|
JS_ENVIRONMENT_RECORD(ObjectEnvironmentRecord, EnvironmentRecord);
|
|
|
|
public:
|
|
ObjectEnvironmentRecord(Object&, EnvironmentRecord* parent_scope);
|
|
|
|
virtual Optional<Variable> get_from_environment_record(FlyString const&) const override;
|
|
virtual void put_into_environment_record(FlyString const&, Variable) override;
|
|
virtual bool delete_from_environment_record(FlyString const&) override;
|
|
|
|
virtual bool has_binding(FlyString const& name) const override;
|
|
virtual void create_mutable_binding(GlobalObject&, FlyString const& name, bool can_be_deleted) override;
|
|
virtual void create_immutable_binding(GlobalObject&, FlyString const& name, bool strict) override;
|
|
virtual void initialize_binding(GlobalObject&, FlyString const& name, Value) override;
|
|
virtual void set_mutable_binding(GlobalObject&, FlyString const& name, Value, bool strict) override;
|
|
virtual Value get_binding_value(GlobalObject&, FlyString const& name, bool strict) override;
|
|
virtual bool delete_binding(GlobalObject&, FlyString const& name) override;
|
|
|
|
Object& object() { return m_object; }
|
|
|
|
private:
|
|
virtual void visit_edges(Visitor&) override;
|
|
|
|
Object& m_object;
|
|
};
|
|
|
|
}
|