From 4a99322972bd744cd97825f6373f1eee3b3d35b1 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 30 Oct 2015 17:32:28 -0700 Subject: handle aliasing local and global --- src/asm2wasm.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/asm2wasm.cpp') diff --git a/src/asm2wasm.cpp b/src/asm2wasm.cpp index c594e520d..7f43c7dbc 100644 --- a/src/asm2wasm.cpp +++ b/src/asm2wasm.cpp @@ -352,7 +352,9 @@ private: AsmType detectAsmType(Ref ast, AsmData *data) { if (ast[0] == NAME) { IString name = ast[1]->getIString(); - if (mappedGlobals.find(name) != mappedGlobals.end()) { + if (!data->isLocal(name)) { + // must be global + assert(mappedGlobals.find(name) != mappedGlobals.end()); return wasmToAsmType(mappedGlobals[name].type); } } @@ -385,12 +387,10 @@ private: #if 0 std::cout << "CHECK\n"; left->stringify(std::cout); - std::cout << " => "; - printWasmType(std::cout, leftType); + std::cout << " => " << printWasmType(leftType); std::cout << '\n'; right->stringify(std::cout); - std::cout << " => "; - printWasmType(std::cout, detectWasmType(right, asmData)); + std::cout << " => " << printWasmType(detectWasmType(right, asmData)) << "\n"; #endif bool isInteger = leftType == WasmType::i32; bool isUnsigned = isUnsignedCoercion(left) || isUnsignedCoercion(right); -- cgit v1.2.3