mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
54
Libraries/LibJS/Runtime/ObjectEnvironment.h
Normal file
54
Libraries/LibJS/Runtime/ObjectEnvironment.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2021, Andreas Kling <andreas@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibJS/Runtime/Environment.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
class ObjectEnvironment final : public Environment {
|
||||
JS_ENVIRONMENT(ObjectEnvironment, Environment);
|
||||
JS_DECLARE_ALLOCATOR(ObjectEnvironment);
|
||||
|
||||
public:
|
||||
enum class IsWithEnvironment {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
virtual ThrowCompletionOr<bool> has_binding(DeprecatedFlyString const& name, Optional<size_t>* = nullptr) const override;
|
||||
virtual ThrowCompletionOr<void> create_mutable_binding(VM&, DeprecatedFlyString const& name, bool can_be_deleted) override;
|
||||
virtual ThrowCompletionOr<void> create_immutable_binding(VM&, DeprecatedFlyString const& name, bool strict) override;
|
||||
virtual ThrowCompletionOr<void> initialize_binding(VM&, DeprecatedFlyString const& name, Value, Environment::InitializeBindingHint) override;
|
||||
virtual ThrowCompletionOr<void> set_mutable_binding(VM&, DeprecatedFlyString const& name, Value, bool strict) override;
|
||||
virtual ThrowCompletionOr<Value> get_binding_value(VM&, DeprecatedFlyString const& name, bool strict) override;
|
||||
virtual ThrowCompletionOr<bool> delete_binding(VM&, DeprecatedFlyString 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:
|
||||
ObjectEnvironment(Object& binding_object, IsWithEnvironment, Environment* outer_environment);
|
||||
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
NonnullGCPtr<Object> m_binding_object;
|
||||
bool m_with_environment { false };
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue