summaryrefslogtreecommitdiff
path: root/src/binary-reader-ast.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-ast.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-ast.cc')
-rw-r--r--src/binary-reader-ast.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/binary-reader-ast.cc b/src/binary-reader-ast.cc
index de0a2a93..2aafc341 100644
--- a/src/binary-reader-ast.cc
+++ b/src/binary-reader-ast.cc
@@ -25,6 +25,7 @@
#include <vector>
#include "ast.h"
+#include "binary-error-handler.h"
#include "binary-reader-nop.h"
#include "common.h"
@@ -264,10 +265,7 @@ Result BinaryReaderAST::AppendExpr(Expr* expr) {
}
bool BinaryReaderAST::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);
}
bool BinaryReaderAST::OnError(const char* message) {