mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:44:58 +00:00
parent
8003bde03d
commit
5a40ce442b
6 changed files with 14 additions and 14 deletions
|
@ -551,7 +551,7 @@ void Linker::link(HashMap<Linker::Name, ExternValue> const& exports)
|
|||
m_unresolved_imports.remove(entry);
|
||||
}
|
||||
|
||||
AK::Result<Vector<ExternValue>, LinkError> Linker::finish()
|
||||
AK::ErrorOr<Vector<ExternValue>, LinkError> Linker::finish()
|
||||
{
|
||||
populate();
|
||||
if (!m_unresolved_imports.is_empty()) {
|
||||
|
|
|
@ -604,7 +604,7 @@ private:
|
|||
Vector<EntryType, 1024> m_data;
|
||||
};
|
||||
|
||||
using InstantiationResult = AK::Result<NonnullOwnPtr<ModuleInstance>, InstantiationError>;
|
||||
using InstantiationResult = AK::ErrorOr<NonnullOwnPtr<ModuleInstance>, InstantiationError>;
|
||||
|
||||
class AbstractMachine {
|
||||
public:
|
||||
|
@ -655,7 +655,7 @@ public:
|
|||
return m_unresolved_imports;
|
||||
}
|
||||
|
||||
AK::Result<Vector<ExternValue>, LinkError> finish();
|
||||
AK::ErrorOr<Vector<ExternValue>, LinkError> finish();
|
||||
|
||||
private:
|
||||
void populate();
|
||||
|
|
|
@ -307,7 +307,7 @@ void BytecodeInterpreter::binary_numeric_operation(Configuration& configuration,
|
|||
auto lhs = lhs_ptr->to<PopTypeLHS>();
|
||||
PushType result;
|
||||
auto call_result = Operator { forward<Args>(args)... }(lhs.value(), rhs.value());
|
||||
if constexpr (IsSpecializationOf<decltype(call_result), AK::Result>) {
|
||||
if constexpr (IsSpecializationOf<decltype(call_result), AK::ErrorOr>) {
|
||||
if (call_result.is_error()) {
|
||||
trap_if_not(false, call_result.error());
|
||||
return;
|
||||
|
@ -328,7 +328,7 @@ void BytecodeInterpreter::unary_operation(Configuration& configuration, Args&&..
|
|||
auto value = entry_ptr->to<PopType>();
|
||||
auto call_result = Operator { forward<Args>(args)... }(*value);
|
||||
PushType result;
|
||||
if constexpr (IsSpecializationOf<decltype(call_result), AK::Result>) {
|
||||
if constexpr (IsSpecializationOf<decltype(call_result), AK::ErrorOr>) {
|
||||
if (call_result.is_error()) {
|
||||
trap_if_not(false, call_result.error());
|
||||
return;
|
||||
|
|
|
@ -58,8 +58,8 @@ struct Divide {
|
|||
Checked value(lhs);
|
||||
value /= rhs;
|
||||
if (value.has_overflow())
|
||||
return AK::Result<Lhs, StringView>("Integer division overflow"sv);
|
||||
return AK::Result<Lhs, StringView>(value.value());
|
||||
return AK::ErrorOr<Lhs, StringView>("Integer division overflow"sv);
|
||||
return AK::ErrorOr<Lhs, StringView>(value.value());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,12 +71,12 @@ struct Modulo {
|
|||
auto operator()(Lhs lhs, Rhs rhs) const
|
||||
{
|
||||
if (rhs == 0)
|
||||
return AK::Result<Lhs, StringView>("Integer division overflow"sv);
|
||||
return AK::ErrorOr<Lhs, StringView>("Integer division overflow"sv);
|
||||
if constexpr (IsSigned<Lhs>) {
|
||||
if (rhs == -1)
|
||||
return AK::Result<Lhs, StringView>(0); // Spec weirdness right here, signed division overflow is ignored.
|
||||
return AK::ErrorOr<Lhs, StringView>(0); // Spec weirdness right here, signed division overflow is ignored.
|
||||
}
|
||||
return AK::Result<Lhs, StringView>(lhs % rhs);
|
||||
return AK::ErrorOr<Lhs, StringView>(lhs % rhs);
|
||||
}
|
||||
|
||||
static StringView name() { return "%"sv; }
|
||||
|
@ -479,7 +479,7 @@ struct Floor {
|
|||
|
||||
struct Truncate {
|
||||
template<typename Lhs>
|
||||
AK::Result<Lhs, StringView> operator()(Lhs lhs) const
|
||||
AK::ErrorOr<Lhs, StringView> operator()(Lhs lhs) const
|
||||
{
|
||||
if constexpr (IsSame<Lhs, float>)
|
||||
return truncf(lhs);
|
||||
|
@ -536,7 +536,7 @@ struct Wrap {
|
|||
template<typename ResultT>
|
||||
struct CheckedTruncate {
|
||||
template<typename Lhs>
|
||||
AK::Result<ResultT, StringView> operator()(Lhs lhs) const
|
||||
AK::ErrorOr<ResultT, StringView> operator()(Lhs lhs) const
|
||||
{
|
||||
if (isnan(lhs) || isinf(lhs)) // "undefined", let's just trap.
|
||||
return "Truncation undefined behavior"sv;
|
||||
|
|
|
@ -28,7 +28,7 @@ static auto parse_vector(Stream& stream)
|
|||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger;
|
||||
if constexpr (requires { T::parse(stream); }) {
|
||||
using ResultT = typename decltype(T::parse(stream))::ValueType;
|
||||
using ResultT = typename decltype(T::parse(stream))::ResultType;
|
||||
auto count_or_error = stream.read_value<LEB128<size_t>>();
|
||||
if (count_or_error.is_error())
|
||||
return ParseResult<Vector<ResultT>> { with_eof_check(stream, ParseError::ExpectedSize) };
|
||||
|
|
|
@ -61,7 +61,7 @@ enum class ParseError {
|
|||
ByteString parse_error_to_byte_string(ParseError);
|
||||
|
||||
template<typename T>
|
||||
using ParseResult = Result<T, ParseError>;
|
||||
using ParseResult = ErrorOr<T, ParseError>;
|
||||
|
||||
AK_TYPEDEF_DISTINCT_ORDERED_ID(size_t, TypeIndex);
|
||||
AK_TYPEDEF_DISTINCT_ORDERED_ID(size_t, FunctionIndex);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue