From e96540b5bc824924b3ddefcce4b609781b0f22de Mon Sep 17 00:00:00 2001 From: Douglas Crosher Date: Sat, 16 Jan 2016 10:44:23 +1100 Subject: Function section has the flags before the signature index. --- src/wasm-binary.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/wasm-binary.h') diff --git a/src/wasm-binary.h b/src/wasm-binary.h index b6b0a55ae..d720c9a79 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -456,11 +456,11 @@ public: type = function->type; } if (debug) std::cerr << "writing" << name << std::endl; - o << getFunctionTypeIndex(type); o << int8_t(BinaryConsts::Named | (BinaryConsts::Import * !!import) | (BinaryConsts::Locals * (function && function->locals.size() > 0)) | (BinaryConsts::Export * (wasm->exportsMap.count(name) > 0))); + o << getFunctionTypeIndex(type); emitString(name.str); if (function && function->locals.size() > 0) { mapLocals(function); @@ -1040,8 +1040,8 @@ public: size_t total = getLEB128(); // imports and functions for (size_t i = 0; i < total; i++) { if (debug) std::cerr << "read one at " << pos << std::endl; - auto type = wasm.functionTypes[getInt16()]; auto data = getInt8(); + auto type = wasm.functionTypes[getInt16()]; bool named = data & BinaryConsts::Named; assert(named); bool import = data & BinaryConsts::Import; -- cgit v1.2.3