mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-21 10:05:32 +00: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
|
@ -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 a new issue