diff options
author | Ben Smith <binji@chromium.org> | 2018-09-03 13:08:23 -0700 |
---|---|---|
committer | Ben Smith <binjimin@gmail.com> | 2018-09-04 15:13:23 -0700 |
commit | e0719fe0fe504c497d9fb7510fe68499c08179f4 (patch) | |
tree | 1e2f3d3b4ac76b239bb75a6f819d8fd1f1cc8050 /src/binary-reader-interp.h | |
parent | b4125e90c70a6b1bef4480e33f3c838ab4c7cfcb (diff) | |
download | wabt-e0719fe0fe504c497d9fb7510fe68499c08179f4.tar.gz wabt-e0719fe0fe504c497d9fb7510fe68499c08179f4.tar.bz2 wabt-e0719fe0fe504c497d9fb7510fe68499c08179f4.zip |
Replace ErrorHandler with Errors and FormatErrors*
`ErrorHandler` complicated all error handling in wabt, since it was
callback-based. Callbacks would be useful if we ever wanted to change
behavior when an error occurred, but instead all that the handler ever
did was write the errors to stdout/stderr or to a buffer.
This change adds a new class `Error`, which contains an `ErrorLevel`, a
`Location` and an error message. It also replaces ErrorHandler with
`Errors` (a typedef for `std::vector<Error>`), and adds a couple of
functions that can format a list of `Errors` for output:
`FormatErrorsTo{String,File}`.
Diffstat (limited to 'src/binary-reader-interp.h')
-rw-r--r-- | src/binary-reader-interp.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/binary-reader-interp.h b/src/binary-reader-interp.h index 82043ce5..767b9479 100644 --- a/src/binary-reader-interp.h +++ b/src/binary-reader-interp.h @@ -18,6 +18,7 @@ #define WABT_BINARY_READER_INTERP_H_ #include "src/common.h" +#include "src/error.h" namespace wabt { @@ -28,14 +29,13 @@ class Environment; } // namespace interp -class ErrorHandler; struct ReadBinaryOptions; Result ReadBinaryInterp(interp::Environment* env, const void* data, size_t size, const ReadBinaryOptions& options, - ErrorHandler*, + Errors*, interp::DefinedModule** out_module); } // namespace wabt |