2020-04-07 15:17:23 +00:00
|
|
|
/*
|
2021-04-22 20:51:19 +00:00
|
|
|
* Copyright (c) 2020, Linus Groh <linusg@serenityos.org>
|
2020-04-07 15:17:23 +00:00
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-04-07 15:17:23 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibJS/Runtime/NativeFunction.h>
|
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
|
|
|
class NumberConstructor final : public NativeFunction {
|
2020-06-21 13:14:02 +00:00
|
|
|
JS_OBJECT(NumberConstructor, NativeFunction);
|
2024-11-14 15:01:23 +00:00
|
|
|
GC_DECLARE_ALLOCATOR(NumberConstructor);
|
2020-06-21 13:14:02 +00:00
|
|
|
|
2020-04-07 15:17:23 +00:00
|
|
|
public:
|
2023-08-07 06:41:28 +00:00
|
|
|
virtual void initialize(Realm&) override;
|
2022-03-14 16:25:06 +00:00
|
|
|
virtual ~NumberConstructor() override = default;
|
2020-04-07 15:17:23 +00:00
|
|
|
|
2021-10-20 20:16:30 +00:00
|
|
|
virtual ThrowCompletionOr<Value> call() override;
|
2024-11-14 15:01:23 +00:00
|
|
|
virtual ThrowCompletionOr<GC::Ref<Object>> construct(FunctionObject& new_target) override;
|
2020-04-07 15:17:23 +00:00
|
|
|
|
|
|
|
private:
|
2022-08-28 21:51:28 +00:00
|
|
|
explicit NumberConstructor(Realm&);
|
|
|
|
|
2020-04-07 15:17:23 +00:00
|
|
|
virtual bool has_constructor() const override { return true; }
|
2020-04-07 17:06:44 +00:00
|
|
|
|
2021-10-28 21:46:14 +00:00
|
|
|
JS_DECLARE_NATIVE_FUNCTION(is_finite);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(is_integer);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(is_nan);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(is_safe_integer);
|
2020-04-07 15:17:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|