summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-07-22 10:40:36 -0400
committerLinus Groh <mail@linusgroh.de>2021-07-23 23:06:57 +0100
commit8c2b8fd001033d557a4ca00cf7b2c6b38b172479 (patch)
treec19b0cd23bc26d0a82165abaf214cbed30d78b85
parent5a8f870594e3619317cf4cd584cbdaacd5ebcdef (diff)
downloadserenity-8c2b8fd001033d557a4ca00cf7b2c6b38b172479.zip
LibJS: Remove UTF-8 RegExpExec and AdvanceStringIndex overrides
All interested parties are now UTF-16 capable, so these are unused.
-rw-r--r--Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp19
-rw-r--r--Userland/Libraries/LibJS/Runtime/RegExpPrototype.h2
2 files changed, 1 insertions, 20 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp
index 59a9b8d53c..75d2d1b359 100644
--- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
* Copyright (c) 2020-2021, Linus Groh <linusg@serenityos.org>
+ * Copyright (c) 2021, Tim Flynn <trflynn89@pm.me>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -103,15 +104,6 @@ size_t advance_string_index(Utf16View const& string, size_t index, bool unicode)
return index + code_point.code_unit_count;
}
-// 22.2.5.2.3 AdvanceStringIndex ( S, index, unicode ), https://tc39.es/ecma262/#sec-advancestringindex
-size_t advance_string_index(String const& string, size_t index, bool unicode)
-{
- auto utf16_string = AK::utf8_to_utf16(string);
- Utf16View utf16_string_view { utf16_string };
-
- return advance_string_index(utf16_string_view, index, unicode);
-}
-
static void increment_last_index(GlobalObject& global_object, Object& regexp_object, Utf16View const& string, bool unicode)
{
auto& vm = global_object.vm();
@@ -347,15 +339,6 @@ Value regexp_exec(GlobalObject& global_object, Object& regexp_object, Utf16View
return regexp_builtin_exec(global_object, static_cast<RegExpObject&>(regexp_object), string);
}
-// 22.2.5.2.1 RegExpExec ( R, S ), https://tc39.es/ecma262/#sec-regexpexec
-Value regexp_exec(GlobalObject& global_object, Object& regexp_object, String const& string)
-{
- auto utf16_string = AK::utf8_to_utf16(string);
- Utf16View utf16_string_view { utf16_string };
-
- return regexp_exec(global_object, regexp_object, utf16_string_view);
-}
-
// 1.1.4.3 get RegExp.prototype.hasIndices, https://tc39.es/proposal-regexp-match-indices/#sec-get-regexp.prototype.hasIndices
// 22.2.5.3 get RegExp.prototype.dotAll, https://tc39.es/ecma262/#sec-get-regexp.prototype.dotAll
// 22.2.5.5 get RegExp.prototype.global, https://tc39.es/ecma262/#sec-get-regexp.prototype.global
diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.h b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.h
index da6093575d..0971e21973 100644
--- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.h
+++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.h
@@ -10,9 +10,7 @@
namespace JS {
-Value regexp_exec(GlobalObject& global_object, Object& regexp_object, String const& string);
Value regexp_exec(GlobalObject& global_object, Object& regexp_object, Utf16View const& string);
-size_t advance_string_index(String const& string, size_t index, bool unicode);
size_t advance_string_index(Utf16View const& string, size_t index, bool unicode);
class RegExpPrototype final : public Object {