5#ifndef V8_WASM_WASM_RESULT_H_
6#define V8_WASM_WASM_RESULT_H_
8#if !V8_ENABLE_WEBASSEMBLY
9#error This header should only be included if WebAssembly is enabled.
40 va_start(
args, format);
41 message_ = FormatError(format,
args);
48 return offset_ != kNoErrorOffset;
51 operator bool()
const {
return has_error(); }
54 const std::string&
message() const& {
return message_; }
55 std::string&&
message() && {
return std::move(message_); }
58 static std::string FormatError(
const char* format, va_list
args);
70 static_assert(!std::is_same<T, WasmError>::value);
71 static_assert(!std::is_reference<T>::value,
72 "Holding a reference in a Result looks like a mistake; remove "
73 "this assertion if you know what you are doing");
94 requires(
std::is_assignable_v<
U, T &&>)
139 DCHECK(error.has_error());
140 CompileError(
"%s @+%u", error.message().c_str(), error.offset());
169 kFirstWasmError = kCompileError
172 void Format(ErrorType error_type_,
const char* fmt, va_list);
ErrorThrower & operator=(const ErrorThrower &)=delete
ErrorThrower(Isolate *isolate, const char *context)
const char *const context_
PRINTF_FORMAT(2, 3) void TypeError(const char *fmt
Isolate * isolate() const
ErrorThrower(const ErrorThrower &)=delete
constexpr const char * context_name() const
Result & operator=(const Result< T > &)=delete
const WasmError & error() const &
Result & operator=(Result< T > &&)=default
const T & value() const &
Result(const Result &)=delete
Result(Result< T > &&)=default
std::string && message() &&
const std::string & message() const &
WasmError(uint32_t offset, std::string message)
Handle< Context > context_
base::Vector< const DirectHandle< Object > > args
constexpr uint32_t kMaxUInt32
#define PRINTF_FORMAT(format_param, dots_param)
#define DCHECK_NE(v1, v2)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
#define DISALLOW_NEW_AND_DELETE()
#define V8_EXPORT_PRIVATE
#define V8_WARN_UNUSED_RESULT