From 3e8516cb75e7941da0b16443fbd4b4a298fa3644 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 29 Oct 2015 19:59:10 -0700 Subject: double fixes --- src/asm2wasm.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/asm2wasm.cpp') diff --git a/src/asm2wasm.cpp b/src/asm2wasm.cpp index 9a7d36ae5..267e36bf6 100644 --- a/src/asm2wasm.cpp +++ b/src/asm2wasm.cpp @@ -624,6 +624,12 @@ void Asm2WasmModule::processAsm(Ref ast) { } Function* Asm2WasmModule::processFunction(Ref ast) { + if (debug) { + std::cout << "func: "; + ast->stringify(std::cout); + std::cout << '\n'; + } + auto function = allocator.alloc(); function->name = ast[1]->getIString(); Ref params = ast[2]; @@ -684,9 +690,9 @@ Function* Asm2WasmModule::processFunction(Ref ast) { std::function process = [&](Ref ast) -> Expression* { AstStackHelper astStackHelper(ast); // TODO: only create one when we need it? if (debug) { - std::cerr << "at: "; - ast->stringify(std::cerr); - std::cerr << '\n'; + std::cout << "at: "; + ast->stringify(std::cout); + std::cout << '\n'; } IString what = ast[0]->getIString(); if (what == STAT) { @@ -824,7 +830,7 @@ Function* Asm2WasmModule::processFunction(Ref ast) { ret->type = BasicType::f64; return ret; } - assert(childType == ASM_NONE); // e.g. a coercion on a call + assert(childType == ASM_NONE || childType == ASM_DOUBLE); // e.g. a coercion on a call or for a return auto ret = process(ast[2]); // just look through the +() coercion ret->type = BasicType::f64; // we add it here for e.g. call coercions return ret; @@ -1203,7 +1209,7 @@ int main(int argc, char **argv) { } if (debug) std::cerr << "parsing...\n"; - cashew::Parser builder; + cashew::Parser builder; Ref asmjs = builder.parseToplevel(input); if (debug) std::cerr << "wasming...\n"; -- cgit v1.2.3