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 * Copyright (c) 2020-2021, Linus Groh + * Copyright (c) 2021, Tim Flynn * * 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(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 {