2020-06-03 16:05:49 -07:00
|
|
|
/*
|
2021-04-22 16:53:07 -07:00
|
|
|
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
|
2020-06-03 16:05:49 -07:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-03 16:05:49 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibJS/Runtime/NativeFunction.h>
|
2022-10-17 08:59:27 +08:00
|
|
|
#include <LibJS/Runtime/RegExpLegacyStaticProperties.h>
|
2020-06-03 16:05:49 -07:00
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
2025-07-19 10:41:08 -07:00
|
|
|
class RegExpConstructor final : public NativeFunction {
|
2020-06-21 15:14:02 +02:00
|
|
|
JS_OBJECT(RegExpConstructor, NativeFunction);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(RegExpConstructor);
|
2020-06-21 15:14:02 +02:00
|
|
|
|
2020-06-03 16:05:49 -07:00
|
|
|
public:
|
2023-08-07 08:41:28 +02:00
|
|
|
virtual void initialize(Realm&) override;
|
2022-03-14 10:25:06 -06:00
|
|
|
virtual ~RegExpConstructor() override = default;
|
2020-06-03 16:05:49 -07:00
|
|
|
|
2021-10-20 21:16:30 +01:00
|
|
|
virtual ThrowCompletionOr<Value> call() override;
|
2024-11-15 04:01:23 +13:00
|
|
|
virtual ThrowCompletionOr<GC::Ref<Object>> construct(FunctionObject& new_target) override;
|
2020-06-03 16:05:49 -07:00
|
|
|
|
2022-10-17 08:59:27 +08:00
|
|
|
RegExpLegacyStaticProperties& legacy_static_properties() { return m_legacy_static_properties; }
|
|
|
|
|
2020-06-03 16:05:49 -07:00
|
|
|
private:
|
2022-08-28 23:51:28 +02:00
|
|
|
explicit RegExpConstructor(Realm&);
|
|
|
|
|
2020-06-03 16:05:49 -07:00
|
|
|
virtual bool has_constructor() const override { return true; }
|
2021-06-07 19:31:32 +03:00
|
|
|
|
2024-12-04 17:12:42 -05:00
|
|
|
JS_DECLARE_NATIVE_FUNCTION(escape);
|
2021-10-23 03:52:55 +03:00
|
|
|
JS_DECLARE_NATIVE_FUNCTION(symbol_species_getter);
|
2022-10-17 08:59:27 +08: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 16:05:49 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|