diff options
Diffstat (limited to 'src/tools/wat2wasm.cc')
-rw-r--r-- | src/tools/wat2wasm.cc | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/tools/wat2wasm.cc b/src/tools/wat2wasm.cc index e1bb192a..e664d589 100644 --- a/src/tools/wat2wasm.cc +++ b/src/tools/wat2wasm.cc @@ -139,25 +139,21 @@ int ProgramMain(int argc, char** argv) { WastParseOptions parse_wast_options(s_features); result = ParseWatModule(lexer.get(), &module, &errors, &parse_wast_options); - if (Succeeded(result)) { - result = ResolveNamesModule(module.get(), &errors); + if (Succeeded(result) && s_validate) { + ValidateOptions options(s_features); + result = ValidateModule(module.get(), &errors, options); + } - if (Succeeded(result) && s_validate) { - ValidateOptions options(s_features); - result = ValidateModule(module.get(), &errors, options); - } + if (Succeeded(result)) { + MemoryStream stream(s_log_stream.get()); + s_write_binary_options.features = s_features; + result = WriteBinaryModule(&stream, module.get(), s_write_binary_options); if (Succeeded(result)) { - MemoryStream stream(s_log_stream.get()); - s_write_binary_options.features = s_features; - result = WriteBinaryModule(&stream, module.get(), s_write_binary_options); - - if (Succeeded(result)) { - if (s_outfile.empty()) { - s_outfile = DefaultOuputName(s_infile); - } - WriteBufferToFile(s_outfile.c_str(), stream.output_buffer()); + if (s_outfile.empty()) { + s_outfile = DefaultOuputName(s_infile); } + WriteBufferToFile(s_outfile.c_str(), stream.output_buffer()); } } |