From f78f159d836ed6920f7a656a693220bbc9b5bbd6 Mon Sep 17 00:00:00 2001 From: Ben Smith Date: Mon, 24 Apr 2017 15:18:57 -0700 Subject: Change {Source,Binary}ErrorHandler to C++ (#403) Added some new classes: * BinaryErrorHandler: abstract base class * BinaryErrorHandlerFile: writes errors to a FILE* * SourceErrorHandler: abstract base class * SourceErrorHandlerNop: eats all errors * SourceErrorHandlerFile: writes errors to a FILE* There are some specific ones as well: * BinaryErrorHandlerAssert: used in wasm-interp to handle writing out a custom header with assertion "failures"; i.e. places where the error handler should fire. * BinaryErrorHandlerModule: used when parsing a .wast, but there's an embedded binary file. --- src/binary-reader-interpreter.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/binary-reader-interpreter.cc') diff --git a/src/binary-reader-interpreter.cc b/src/binary-reader-interpreter.cc index db5f9719..fcb6fede 100644 --- a/src/binary-reader-interpreter.cc +++ b/src/binary-reader-interpreter.cc @@ -23,6 +23,7 @@ #include +#include "binary-error-handler.h" #include "binary-reader-nop.h" #include "interpreter.h" #include "type-checker.h" @@ -322,10 +323,7 @@ Label* BinaryReaderInterpreter::TopLabel() { bool BinaryReaderInterpreter::HandleError(uint32_t offset, const char* message) { - if (error_handler->on_error) { - return error_handler->on_error(offset, message, error_handler->user_data); - } - return false; + return error_handler->OnError(offset, message); } void WABT_PRINTF_FORMAT(2, 3) -- cgit v1.2.3