From 84288282ef586d5664159b9a9fc54dacfc89c052 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 11 Dec 2015 23:16:13 -0500 Subject: handle missing assign in call as a discard --- src/s2wasm.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/s2wasm.h b/src/s2wasm.h index 0c56e4bfb..b9ae08c02 100644 --- a/src/s2wasm.h +++ b/src/s2wasm.h @@ -264,10 +264,10 @@ private: } }; auto setOutput = [&](Expression* curr, Name assign) { - if (assign.str[1] == 'p') { // push - estack.push_back(curr); - } else if (assign.str[1] == 'd') { // discard + if (assign.isNull() || assign.str[1] == 'd') { // discard bstack.back()->list.push_back(curr); + } else if (assign.str[1] == 'p') { // push + estack.push_back(curr); } else { // set to a local auto set = allocator.alloc(); set->name = assign; @@ -351,8 +351,11 @@ private: default: abort_on("i32.?"); } } else if (match("call")) { - Name assign = getAssign(); - skipComma(); + Name assign; + if (*s == '$') { + assign = getAssign(); + skipComma(); + } auto curr = allocator.alloc(); curr->target = getCommaSeparated(); while (1) { -- cgit v1.2.3