2020-04-04 17:28:21 -03:00
|
|
|
/*
|
2024-10-04 08:19:50 -03:00
|
|
|
* Copyright (c) 2020, Andreas Kling <andreas@ladybird.org>
|
2020-04-04 17:28:21 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-04-04 17:28:21 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <LibJS/Runtime/NativeFunction.h>
|
|
|
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
|
2025-07-19 14:41:08 -03:00
|
|
|
class ArrayConstructor final : public NativeFunction {
|
2020-06-21 10:14:02 -03:00
|
|
|
JS_OBJECT(ArrayConstructor, NativeFunction);
|
2024-11-14 12:01:23 -03:00
|
|
|
GC_DECLARE_ALLOCATOR(ArrayConstructor);
|
2020-06-21 10:14:02 -03:00
|
|
|
|
2020-04-04 17:28:21 -03:00
|
|
|
public:
|
2023-08-07 03:41:28 -03:00
|
|
|
virtual void initialize(Realm&) override;
|
2022-03-14 13:25:06 -03:00
|
|
|
virtual ~ArrayConstructor() override = default;
|
2020-04-04 17:28:21 -03:00
|
|
|
|
2021-10-20 17:16:30 -03:00
|
|
|
virtual ThrowCompletionOr<Value> call() override;
|
2024-11-14 12:01:23 -03:00
|
|
|
virtual ThrowCompletionOr<GC::Ref<Object>> construct(FunctionObject& new_target) override;
|
2020-04-04 17:28:21 -03:00
|
|
|
|
|
|
|
|
private:
|
2022-08-28 18:51:28 -03:00
|
|
|
explicit ArrayConstructor(Realm&);
|
|
|
|
|
|
2020-04-04 17:28:21 -03:00
|
|
|
virtual bool has_constructor() const override { return true; }
|
2020-05-08 12:28:35 -03:00
|
|
|
|
2021-10-22 19:51:56 -03:00
|
|
|
JS_DECLARE_NATIVE_FUNCTION(from);
|
2023-07-15 07:37:22 -03:00
|
|
|
JS_DECLARE_NATIVE_FUNCTION(from_async);
|
2021-10-22 19:51:56 -03:00
|
|
|
JS_DECLARE_NATIVE_FUNCTION(is_array);
|
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(of);
|
2021-06-07 13:31:32 -03:00
|
|
|
|
2021-10-22 19:51:56 -03:00
|
|
|
JS_DECLARE_NATIVE_FUNCTION(symbol_species_getter);
|
2020-04-04 17:28:21 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|