mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:57:34 +00:00
LibJS: Drop "Record" suffix from all the *Environment record classes
"Records" in the spec are basically C++ classes, so let's drop this mouthful of a suffix.
This commit is contained in:
parent
56d25d7210
commit
44221756ab
40 changed files with 366 additions and 366 deletions
56
Userland/Libraries/LibJS/Runtime/ObjectEnvironment.h
Normal file
56
Userland/Libraries/LibJS/Runtime/ObjectEnvironment.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibJS/Runtime/Environment.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
class ObjectEnvironment : public Environment {
|
||||
JS_ENVIRONMENT(ObjectEnvironment, Environment);
|
||||
|
||||
public:
|
||||
enum class IsWithEnvironment {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
ObjectEnvironment(Object& binding_object, IsWithEnvironment, Environment* outer_environment);
|
||||
|
||||
virtual Optional<Variable> get_from_environment(FlyString const&) const override;
|
||||
virtual void put_into_environment(FlyString const&, Variable) override;
|
||||
virtual bool delete_from_environment(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;
|
||||
|
||||
// 9.1.1.2.10 WithBaseObject ( ), https://tc39.es/ecma262/#sec-object-environment-records-withbaseobject
|
||||
virtual Object* with_base_object() const override
|
||||
{
|
||||
if (is_with_environment())
|
||||
return &m_binding_object;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// [[BindingObject]], The binding object of this Environment Record.
|
||||
Object& binding_object() { return m_binding_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_binding_object;
|
||||
bool m_with_environment { false };
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue