FunctionPrototype.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2020-2022, Linus Groh <linusg@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibJS/Runtime/FunctionObject.h>
  8. namespace JS {
  9. class FunctionPrototype final : public FunctionObject {
  10. JS_OBJECT(FunctionPrototype, FunctionObject);
  11. GC_DECLARE_ALLOCATOR(FunctionPrototype);
  12. public:
  13. virtual void initialize(Realm&) override;
  14. virtual ~FunctionPrototype() override = default;
  15. virtual ThrowCompletionOr<Value> internal_call(Value this_argument, ReadonlySpan<Value> arguments_list) override;
  16. virtual DeprecatedFlyString const& name() const override { return m_name; }
  17. private:
  18. explicit FunctionPrototype(Realm&);
  19. JS_DECLARE_NATIVE_FUNCTION(apply);
  20. JS_DECLARE_NATIVE_FUNCTION(bind);
  21. JS_DECLARE_NATIVE_FUNCTION(call);
  22. JS_DECLARE_NATIVE_FUNCTION(to_string);
  23. JS_DECLARE_NATIVE_FUNCTION(symbol_has_instance);
  24. // Totally unnecessary, but sadly still necessary.
  25. // TODO: Get rid of the pointless name() method.
  26. DeprecatedFlyString m_name { "FunctionPrototype" };
  27. };
  28. }