2020-06-03 23:05:49 +00:00
|
|
|
/*
|
2021-04-22 23:53:07 +00:00
|
|
|
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
|
2020-06-03 23:05:49 +00:00
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-03 23:05:49 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibJS/Runtime/NativeFunction.h>
|
2022-10-17 00:59:27 +00:00
|
|
|
#include <LibJS/Runtime/RegExpLegacyStaticProperties.h>
|
2020-06-03 23:05:49 +00:00
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
|
|
|
class RegExpConstructor final : public NativeFunction {
|
2020-06-21 13:14:02 +00:00
|
|
|
JS_OBJECT(RegExpConstructor, NativeFunction);
|
2024-11-14 15:01:23 +00:00
|
|
|
GC_DECLARE_ALLOCATOR(RegExpConstructor);
|
2020-06-21 13:14:02 +00:00
|
|
|
|
2020-06-03 23:05:49 +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 ~RegExpConstructor() override = default;
|
2020-06-03 23:05:49 +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-06-03 23:05:49 +00:00
|
|
|
|
2022-10-17 00:59:27 +00:00
|
|
|
RegExpLegacyStaticProperties& legacy_static_properties() { return m_legacy_static_properties; }
|
|
|
|
|
2020-06-03 23:05:49 +00:00
|
|
|
private:
|
2022-08-28 21:51:28 +00:00
|
|
|
explicit RegExpConstructor(Realm&);
|
|
|
|
|
2020-06-03 23:05:49 +00:00
|
|
|
virtual bool has_constructor() const override { return true; }
|
2021-06-07 16:31:32 +00:00
|
|
|
|
2021-10-23 00:52:55 +00:00
|
|
|
JS_DECLARE_NATIVE_FUNCTION(symbol_species_getter);
|
2022-10-17 00:59:27 +00:00
|
|
|
JS_DECLARE_NATIVE_FUNCTION(input_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(input_alias_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(input_setter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(input_alias_setter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(last_match_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(last_match_alias_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(last_paren_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(last_paren_alias_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(left_context_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(left_context_alias_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(right_context_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(right_context_alias_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(group_1_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(group_2_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(group_3_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(group_4_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(group_5_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(group_6_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(group_7_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(group_8_getter);
|
|
|
|
JS_DECLARE_NATIVE_FUNCTION(group_9_getter);
|
|
|
|
|
|
|
|
RegExpLegacyStaticProperties m_legacy_static_properties;
|
2020-06-03 23:05:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|