InstantConstructor.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibJS/Runtime/NativeFunction.h>
  8. namespace JS::Temporal {
  9. class InstantConstructor final : public NativeFunction {
  10. JS_OBJECT(InstantConstructor, NativeFunction);
  11. JS_DECLARE_ALLOCATOR(InstantConstructor);
  12. public:
  13. virtual void initialize(Realm&) override;
  14. virtual ~InstantConstructor() override = default;
  15. virtual ThrowCompletionOr<Value> call() override;
  16. virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override;
  17. private:
  18. explicit InstantConstructor(Realm&);
  19. virtual bool has_constructor() const override { return true; }
  20. JS_DECLARE_NATIVE_FUNCTION(from);
  21. JS_DECLARE_NATIVE_FUNCTION(from_epoch_seconds);
  22. JS_DECLARE_NATIVE_FUNCTION(from_epoch_milliseconds);
  23. JS_DECLARE_NATIVE_FUNCTION(from_epoch_microseconds);
  24. JS_DECLARE_NATIVE_FUNCTION(from_epoch_nanoseconds);
  25. JS_DECLARE_NATIVE_FUNCTION(compare);
  26. };
  27. }