From d0fd34112fb964d0fb198c3a66207bcc1b4c670e Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 6 Sep 2023 08:29:52 -0400 Subject: [PATCH] LibJS: Remove the now-unused ThrowableStringBuilder --- .../Userland/Libraries/LibJS/BUILD.gn | 1 - Userland/Libraries/LibJS/CMakeLists.txt | 1 - .../LibJS/Runtime/ThrowableStringBuilder.cpp | 46 ---------------- .../LibJS/Runtime/ThrowableStringBuilder.h | 52 ------------------- 4 files changed, 100 deletions(-) delete mode 100644 Userland/Libraries/LibJS/Runtime/ThrowableStringBuilder.cpp delete mode 100644 Userland/Libraries/LibJS/Runtime/ThrowableStringBuilder.h diff --git a/Meta/gn/secondary/Userland/Libraries/LibJS/BUILD.gn b/Meta/gn/secondary/Userland/Libraries/LibJS/BUILD.gn index 557db0f029..113c786b0d 100644 --- a/Meta/gn/secondary/Userland/Libraries/LibJS/BUILD.gn +++ b/Meta/gn/secondary/Userland/Libraries/LibJS/BUILD.gn @@ -256,7 +256,6 @@ shared_library("LibJS") { "Runtime/Temporal/ZonedDateTime.cpp", "Runtime/Temporal/ZonedDateTimeConstructor.cpp", "Runtime/Temporal/ZonedDateTimePrototype.cpp", - "Runtime/ThrowableStringBuilder.cpp", "Runtime/TypedArray.cpp", "Runtime/TypedArrayConstructor.cpp", "Runtime/TypedArrayPrototype.cpp", diff --git a/Userland/Libraries/LibJS/CMakeLists.txt b/Userland/Libraries/LibJS/CMakeLists.txt index a6081e62f3..b6c536cc83 100644 --- a/Userland/Libraries/LibJS/CMakeLists.txt +++ b/Userland/Libraries/LibJS/CMakeLists.txt @@ -238,7 +238,6 @@ set(SOURCES Runtime/Temporal/ZonedDateTime.cpp Runtime/Temporal/ZonedDateTimeConstructor.cpp Runtime/Temporal/ZonedDateTimePrototype.cpp - Runtime/ThrowableStringBuilder.cpp Runtime/TypedArray.cpp Runtime/TypedArrayConstructor.cpp Runtime/TypedArrayPrototype.cpp diff --git a/Userland/Libraries/LibJS/Runtime/ThrowableStringBuilder.cpp b/Userland/Libraries/LibJS/Runtime/ThrowableStringBuilder.cpp deleted file mode 100644 index 256fdb3311..0000000000 --- a/Userland/Libraries/LibJS/Runtime/ThrowableStringBuilder.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2023, Tim Flynn - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include -#include - -namespace JS { - -ThrowableStringBuilder::ThrowableStringBuilder(VM& vm) - : m_vm(vm) -{ -} - -ThrowCompletionOr ThrowableStringBuilder::append(char ch) -{ - TRY_OR_THROW_OOM(m_vm, try_append(ch)); - return {}; -} - -ThrowCompletionOr ThrowableStringBuilder::append(StringView string) -{ - TRY_OR_THROW_OOM(m_vm, try_append(string)); - return {}; -} - -ThrowCompletionOr ThrowableStringBuilder::append(Utf16View const& string) -{ - TRY_OR_THROW_OOM(m_vm, try_append(string)); - return {}; -} - -ThrowCompletionOr ThrowableStringBuilder::append_code_point(u32 value) -{ - TRY_OR_THROW_OOM(m_vm, try_append_code_point(value)); - return {}; -} - -ThrowCompletionOr ThrowableStringBuilder::to_string() const -{ - return TRY_OR_THROW_OOM(m_vm, StringBuilder::to_string()); -} - -} diff --git a/Userland/Libraries/LibJS/Runtime/ThrowableStringBuilder.h b/Userland/Libraries/LibJS/Runtime/ThrowableStringBuilder.h deleted file mode 100644 index 452d0ff0b4..0000000000 --- a/Userland/Libraries/LibJS/Runtime/ThrowableStringBuilder.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2023, Tim Flynn - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -namespace JS { - -class ThrowableStringBuilder : private AK::StringBuilder { -public: - explicit ThrowableStringBuilder(VM&); - - ThrowCompletionOr append(char); - ThrowCompletionOr append(StringView); - ThrowCompletionOr append(Utf16View const&); - ThrowCompletionOr append_code_point(u32 value); - ThrowCompletionOr to_string() const; - - template - ThrowCompletionOr appendff(CheckedFormatString&& fmtstr, Parameters const&... parameters) - { - AK::VariadicFormatParams variadic_format_params { parameters... }; - TRY_OR_THROW_OOM(m_vm, vformat(*this, fmtstr.view(), variadic_format_params)); - return {}; - } - - template - ThrowCompletionOr join(SeparatorType const& separator, CollectionType const& collection, StringView fmtstr = "{}"sv) - { - TRY_OR_THROW_OOM(m_vm, try_join(separator, collection, fmtstr)); - return {}; - } - - using AK::StringBuilder::is_empty; - using AK::StringBuilder::string_view; - using AK::StringBuilder::trim; - -private: - VM& m_vm; -}; - -}