summaryrefslogtreecommitdiff
path: root/src/asm2wasm.h
diff options
context:
space:
mode:
authorJF Bastien <jfb@chromium.org>2016-03-18 12:40:10 -0700
committerJF Bastien <jfb@chromium.org>2016-03-18 12:40:10 -0700
commit72c5e955d27436d9a6dae4191f6cc6a52676438e (patch)
tree637d16a2bb12996034f6ba25f3f9f1430fa4486f /src/asm2wasm.h
parenta3312f5f2390bf3fe515c99d29d22dff201eeaf9 (diff)
downloadbinaryen-72c5e955d27436d9a6dae4191f6cc6a52676438e.tar.gz
binaryen-72c5e955d27436d9a6dae4191f6cc6a52676438e.tar.bz2
binaryen-72c5e955d27436d9a6dae4191f6cc6a52676438e.zip
Make --debug a boolean
As discussed in #248.
Diffstat (limited to 'src/asm2wasm.h')
-rw-r--r--src/asm2wasm.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index c4f73b57a..eb1471382 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -150,7 +150,7 @@ class Asm2WasmBuilder {
std::map<CallIndirect*, IString> callIndirects; // track these, as we need to fix them after we know the functionTableStarts. this maps call => its function table
bool memoryGrowth;
- int debug;
+ bool debug;
public:
std::map<IString, MappedGlobal> mappedGlobals;
@@ -254,7 +254,7 @@ private:
}
public:
- Asm2WasmBuilder(AllocatingModule& wasm, bool memoryGrowth, int debug)
+ Asm2WasmBuilder(AllocatingModule& wasm, bool memoryGrowth, bool debug)
: wasm(wasm),
allocator(wasm.allocator),
nextGlobal(8),
@@ -729,10 +729,8 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
if (debug) {
std::cout << "\nfunc: " << ast[1]->getIString().str << '\n';
- if (debug >= 2) {
- ast->stringify(std::cout);
- std::cout << '\n';
- }
+ ast->stringify(std::cout);
+ std::cout << '\n';
}
auto function = allocator.alloc<Function>();
@@ -802,11 +800,9 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
std::function<Expression* (Ref)> process = [&](Ref ast) -> Expression* {
AstStackHelper astStackHelper(ast); // TODO: only create one when we need it?
- if (debug >= 2) {
- std::cout << "at: ";
- ast->stringify(std::cout);
- std::cout << '\n';
- }
+ std::cout << "at: ";
+ ast->stringify(std::cout);
+ std::cout << '\n';
IString what = ast[0]->getIString();
if (what == STAT) {
return process(ast[1]); // and drop return value, if any