diff options
author | Ben Smith <binjimin@gmail.com> | 2017-04-25 22:09:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-25 22:09:56 -0700 |
commit | ab4290e57d39ef079e82377d91bd27dcde4d73ae (patch) | |
tree | 39d503d304b69e9ca25bb881dfaa9454bb6a898c /src/source-error-handler.cc | |
parent | 27b992d8bc9a359a5d4256835d2d965ce92eda69 (diff) | |
download | wabt-ab4290e57d39ef079e82377d91bd27dcde4d73ae.tar.gz wabt-ab4290e57d39ef079e82377d91bd27dcde4d73ae.tar.bz2 wabt-ab4290e57d39ef079e82377d91bd27dcde4d73ae.zip |
Fix emscripten demo and libwabt.js (#407)
This removes the more complicated emscripten wrapper we used before, in
favor of something that is much simpler.
* Remove the memory init file
* Remove the onInputKey handling in the demo so it doesn't auto-indent
(it was broken now that we have the flat syntax)
* Simplify emscripten-helpers to provide very simple C-function wrappers
around the wast2wasm API:
* wabt_parse_ast
* wabt_resolve_names_script
* wabt_validate_script
* wabt_write_binary_module
The tricky part is that some functions return multiple values, so
those are returned as structs as well:
* WabtParseAstResult
* WabtWriteBinaryModuleResult
Diffstat (limited to 'src/source-error-handler.cc')
-rw-r--r-- | src/source-error-handler.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/source-error-handler.cc b/src/source-error-handler.cc index 32976b77..87074ddc 100644 --- a/src/source-error-handler.cc +++ b/src/source-error-handler.cc @@ -82,4 +82,17 @@ void SourceErrorHandlerFile::PrintErrorHeader() { fprintf(file_, " "); } +SourceErrorHandlerBuffer::SourceErrorHandlerBuffer( + size_t source_line_max_length) + : source_line_max_length_(source_line_max_length) {} + +bool SourceErrorHandlerBuffer::OnError(const Location* loc, + const std::string& error, + const std::string& source_line, + size_t source_line_column_offset) { + buffer_ += + DefaultErrorMessage(loc, error, source_line, source_line_column_offset); + return true; +} + } // namespace wabt |