diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2017-09-01 14:26:01 -0400 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2017-09-01 11:26:01 -0700 |
commit | b013f744e3d70effd9be348cbde7fb93f0a16c6a (patch) | |
tree | 3b122293005d3370c931175eed92ad61e9dfd851 /src/emscripten-optimizer | |
parent | b1e8b1b515b2a1d0264975abc4de39c8044f7195 (diff) | |
download | binaryen-b013f744e3d70effd9be348cbde7fb93f0a16c6a.tar.gz binaryen-b013f744e3d70effd9be348cbde7fb93f0a16c6a.tar.bz2 binaryen-b013f744e3d70effd9be348cbde7fb93f0a16c6a.zip |
i64 to i32 lowering for wasm2asm (#1134)
Diffstat (limited to 'src/emscripten-optimizer')
-rw-r--r-- | src/emscripten-optimizer/simple_ast.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/emscripten-optimizer/simple_ast.h b/src/emscripten-optimizer/simple_ast.h index 870765323..62bf975f0 100644 --- a/src/emscripten-optimizer/simple_ast.h +++ b/src/emscripten-optimizer/simple_ast.h @@ -1006,7 +1006,7 @@ struct JSPrinter { if (childPrecedence < parentPrecedence) return false; // definitely cool // equal precedence, so associativity (rtl/ltr) is what matters // (except for some exceptions, where multiple operators can combine into confusion) - if (parent[0] == UNARY_PREFIX) { + if (parent->isArray() && parent[0] == UNARY_PREFIX) { assert(child[0] == UNARY_PREFIX); if ((parent[1] == PLUS || parent[1] == MINUS) && child[1] == parent[1]) { // cannot emit ++x when we mean +(+x) @@ -1036,8 +1036,10 @@ struct JSPrinter { } void printUnaryPrefix(Ref node) { - if (finalize && node[1] == PLUS && (node[2]->isNumber() || - (node[2][0] == UNARY_PREFIX && node[2][1] == MINUS && node[2][2]->isNumber()))) { + if (finalize && node[1] == PLUS && + (node[2]->isNumber() || + (node[2]->isArray() && node[2][0] == UNARY_PREFIX && + node[2][1] == MINUS && node[2][2]->isNumber()))) { // emit a finalized number int last = used; print(node[2]); |