ArgumentsObject.h 1.5 KB

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