/src/serenity/Userland/Libraries/LibJS/Runtime/ArgumentsObject.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2021, Andreas Kling <kling@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibJS/Runtime/Completion.h> |
10 | | #include <LibJS/Runtime/Environment.h> |
11 | | #include <LibJS/Runtime/Object.h> |
12 | | |
13 | | namespace JS { |
14 | | |
15 | | class ArgumentsObject final : public Object { |
16 | | JS_OBJECT(ArgumentsObject, Object); |
17 | | JS_DECLARE_ALLOCATOR(ArgumentsObject); |
18 | | |
19 | | public: |
20 | | virtual void initialize(Realm&) override; |
21 | | virtual ~ArgumentsObject() override = default; |
22 | | |
23 | 0 | Environment& environment() { return m_environment; } |
24 | | |
25 | | virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyKey const&) const override; |
26 | | virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyKey const&, PropertyDescriptor const&, Optional<PropertyDescriptor>* precomputed_get_own_property = nullptr) override; |
27 | | virtual ThrowCompletionOr<Value> internal_get(PropertyKey const&, Value receiver, CacheablePropertyMetadata*, PropertyLookupPhase) const override; |
28 | | virtual ThrowCompletionOr<bool> internal_set(PropertyKey const&, Value value, Value receiver, CacheablePropertyMetadata*) override; |
29 | | virtual ThrowCompletionOr<bool> internal_delete(PropertyKey const&) override; |
30 | | |
31 | | // [[ParameterMap]] |
32 | 0 | Object& parameter_map() { return *m_parameter_map; } |
33 | | |
34 | | private: |
35 | | ArgumentsObject(Realm&, Environment&); |
36 | | |
37 | | virtual void visit_edges(Cell::Visitor&) override; |
38 | | |
39 | | NonnullGCPtr<Environment> m_environment; |
40 | | GCPtr<Object> m_parameter_map; |
41 | | }; |
42 | | |
43 | | } |