summaryrefslogtreecommitdiff
path: root/src/asm2wasm.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-10-29 19:59:10 -0700
committerAlon Zakai <alonzakai@gmail.com>2015-10-29 19:59:10 -0700
commit3e8516cb75e7941da0b16443fbd4b4a298fa3644 (patch)
treecda4a993ac8b30ec507f930edf02920142e25531 /src/asm2wasm.cpp
parent88b6549b74dd767733cd823de410e00067a79756 (diff)
downloadbinaryen-3e8516cb75e7941da0b16443fbd4b4a298fa3644.tar.gz
binaryen-3e8516cb75e7941da0b16443fbd4b4a298fa3644.tar.bz2
binaryen-3e8516cb75e7941da0b16443fbd4b4a298fa3644.zip
double fixes
Diffstat (limited to 'src/asm2wasm.cpp')
-rw-r--r--src/asm2wasm.cpp16
1 files changed, 11 insertions, 5 deletions
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>();
function->name = ast[1]->getIString();
Ref params = ast[2];
@@ -684,9 +690,9 @@ Function* Asm2WasmModule::processFunction(Ref ast) {
std::function<Expression* (Ref)> 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<Ref, ValueBuilder> builder;
+ cashew::Parser<Ref, DotZeroValueBuilder> builder;
Ref asmjs = builder.parseToplevel(input);
if (debug) std::cerr << "wasming...\n";