diff options
author | Thomas Lively <tlively@google.com> | 2024-04-29 13:26:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-29 13:26:32 -0700 |
commit | 85a8600ec0d205d414b2d0873f840568008d6d93 (patch) | |
tree | cbaa9ecceda7f38f79a4df2cd0d8e0f0bd48137a /test/example/module-splitting.cpp | |
parent | be001f7e214c31ee1d7864a7081634b8986d72bf (diff) | |
download | binaryen-85a8600ec0d205d414b2d0873f840568008d6d93.tar.gz binaryen-85a8600ec0d205d414b2d0873f840568008d6d93.tar.bz2 binaryen-85a8600ec0d205d414b2d0873f840568008d6d93.zip |
Use the new wat parser in tests (#6556)
Some of the example and gtest tests parse wat. Update them to use the new wat
parser, fixing problems with their text input. In one case, comment out an
outlining test entirely for now because the new parser produces different IR
that changes the test output, but it is not obvious how to understand and fix
the test.
Diffstat (limited to 'test/example/module-splitting.cpp')
-rw-r--r-- | test/example/module-splitting.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/test/example/module-splitting.cpp b/test/example/module-splitting.cpp index cb3df4e78..3f74c252c 100644 --- a/test/example/module-splitting.cpp +++ b/test/example/module-splitting.cpp @@ -3,6 +3,7 @@ #include "ir/module-splitting.h" #include "ir/stack-utils.h" +#include "parser/wat-parser.h" #include "wasm-features.h" #include "wasm-s-parser.h" #include "wasm-validator.h" @@ -13,13 +14,9 @@ using namespace wasm; std::unique_ptr<Module> parse(char* module) { auto wasm = std::make_unique<Module>(); wasm->features = FeatureSet::All; - try { - SExpressionParser parser(module); - Element& root = *parser.root; - SExpressionWasmBuilder builder(*wasm, *root[0], IRProfile::Normal); - } catch (ParseException& p) { - p.dump(std::cerr); - Fatal() << "error in parsing wasm text"; + auto parsed = WATParser::parseModule(*wasm, module); + if (auto* err = parsed.getErr()) { + Fatal() << err->msg << "\n"; } return wasm; } |