mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03:00
AK: Add a Error::__jakt_from_string_literal(StringView) factory function
Note that Jakt only allows StringView creation from string literals, so none of the invariants in the class are broken by this (if used only from within Jakt).
This commit is contained in:
parent
537924a8d0
commit
1cc8cdcd23
Notes:
sideshowbarker
2024-07-17 03:26:05 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/1cc8cdcd23 Pull-request: https://github.com/SerenityOS/serenity/pull/16396 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/awesomekling ✅
@ -37,6 +37,13 @@ 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<SameAs<StringView> 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_syscall == other.m_syscall;
|
||||
|
Loading…
Reference in New Issue
Block a user