1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:48:12 +00:00
serenity/Userland/Libraries/LibJS/Runtime/ObjectEnvironmentRecord.h
Andreas Kling 1f8b6ac3c3 LibJS: Begin implementing GlobalEnvironmentRecord
These represent the outermost scope in the environment record
hierarchy. The spec says they should be a "composite" of two things:

- An ObjectEnvironmentRecord wrapping the global object
- A DeclarativeEnvironmentRecord for other declarations

It's not yet clear to me how this should work, so this patch only
implements the first part, an object record wrapping the global object.
2021-06-22 18:44:53 +02:00

31 lines
775 B
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_OBJECT(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;
Object& object() { return m_object; }
private:
virtual void visit_edges(Visitor&) override;
Object& m_object;
};
}