diff --git a/AK/Error.h b/AK/Error.h index 6d445203548..9f34f2ea668 100644 --- a/AK/Error.h +++ b/AK/Error.h @@ -74,13 +74,6 @@ public: return from_string_view(StringView { string_literal, N - 1 }); } - // Note: Don't call this from C++; it's here for Jakt interop (as the name suggests). - template T> - ALWAYS_INLINE static Error __jakt_from_string_literal(T string) - { - return from_string_view(string); - } - bool operator==(Error const& other) const { return m_code == other.m_code && m_string_literal == other.m_string_literal && m_kind == other.m_kind; diff --git a/AK/StringView.h b/AK/StringView.h index 81b1cf87f57..6c389d64345 100644 --- a/AK/StringView.h +++ b/AK/StringView.h @@ -22,6 +22,7 @@ namespace AK { class StringView { public: ALWAYS_INLINE constexpr StringView() = default; + ALWAYS_INLINE constexpr StringView(char const* characters, size_t length) : m_characters(characters) , m_length(length) @@ -29,24 +30,20 @@ public: if (!is_constant_evaluated()) VERIFY(!Checked::addition_would_overflow(reinterpret_cast(characters), length)); } + ALWAYS_INLINE StringView(unsigned char const* characters, size_t length) : m_characters(reinterpret_cast(characters)) , m_length(length) { VERIFY(!Checked::addition_would_overflow(reinterpret_cast(characters), length)); } + ALWAYS_INLINE StringView(ReadonlyBytes bytes) : m_characters(reinterpret_cast(bytes.data())) , m_length(bytes.size()) { } - // Note: This is here for Jakt. - ALWAYS_INLINE static StringView from_string_literal(StringView string) - { - return string; - } - StringView(ByteBuffer const&); StringView(String const&); StringView(FlyString const&);