diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/binaryen-shell.cpp | 2 | ||||
-rw-r--r-- | src/wasm-s-parser.h | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/binaryen-shell.cpp b/src/binaryen-shell.cpp index 4c4e21f6f..5c2e303fd 100644 --- a/src/binaryen-shell.cpp +++ b/src/binaryen-shell.cpp @@ -259,7 +259,7 @@ int main(int argc, char **argv) { while (i < root.size()) { if (debug) std::cerr << "parsing s-expressions to wasm...\n"; AllocatingModule wasm; - SExpressionWasmBuilder builder(wasm, *root[i], [&]() { abort(); }); + SExpressionWasmBuilder builder(wasm, *root[i], [&]() { abort(); }, debug); i++; auto interface = new ShellExternalInterface(); diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index 4817fdf48..f204d933a 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -223,10 +223,11 @@ class SExpressionWasmBuilder { std::function<void ()> onError; int functionCounter; std::map<Name, WasmType> functionTypes; // we need to know function return types before we parse their contents + bool debug; public: // Assumes control of and modifies the input. - SExpressionWasmBuilder(AllocatingModule& wasm, Element& module, std::function<void ()> onError) : wasm(wasm), allocator(wasm.allocator), onError(onError) { + SExpressionWasmBuilder(AllocatingModule& wasm, Element& module, std::function<void ()> onError, bool debug=false) : wasm(wasm), allocator(wasm.allocator), onError(onError), debug(debug) { assert(module[0]->str() == MODULE); functionCounter = 0; for (unsigned i = 1; i < module.size(); i++) { @@ -410,7 +411,7 @@ public: #define abort_on(str) { std::cerr << "aborting on " << str << '\n'; onError(); } Expression* parseExpression(Element& s) { - //std::cerr << "parse expression " << s << '\n'; + if (debug) std::cerr << "parse expression " << s << '\n'; IString id = s[0]->str(); const char *str = id.str; const char *dot = strchr(str, '.'); |