Browse Source

LibJS: Remove UTF-8 RegExpExec and AdvanceStringIndex overrides

All interested parties are now UTF-16 capable, so these are unused.
Timothy Flynn 4 years ago
parent
commit
8c2b8fd001

+ 1 - 18
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

+ 0 - 2
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 {