summaryrefslogtreecommitdiff
path: root/src/binary-reader-interpreter.cc
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2017-04-24 15:18:57 -0700
committerGitHub <noreply@github.com>2017-04-24 15:18:57 -0700
commitf78f159d836ed6920f7a656a693220bbc9b5bbd6 (patch)
tree6b54d78ead821b7b524492bdde1ba8588d358bbb /src/binary-reader-interpreter.cc
parentbcdb11f2ab3d778a83bf53ddfbd174b70ebaf02a (diff)
downloadwabt-f78f159d836ed6920f7a656a693220bbc9b5bbd6.tar.gz
wabt-f78f159d836ed6920f7a656a693220bbc9b5bbd6.tar.bz2
wabt-f78f159d836ed6920f7a656a693220bbc9b5bbd6.zip
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.
Diffstat (limited to 'src/binary-reader-interpreter.cc')
-rw-r--r--src/binary-reader-interpreter.cc6
1 files changed, 2 insertions, 4 deletions
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 <vector>
+#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)