diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-09-20 16:18:21 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-09-20 16:24:57 -0700 |
commit | 64bfe1d84db6c0b9b63aa27bb2c2cb1d79f3f504 (patch) | |
tree | 5ef9db5ec87973905268186de1f581045823e8e7 /src/wasm-s-parser.h | |
parent | 98f2a79dd9ceb95c8df55d3fd755a886e65c567f (diff) | |
download | binaryen-64bfe1d84db6c0b9b63aa27bb2c2cb1d79f3f504.tar.gz binaryen-64bfe1d84db6c0b9b63aa27bb2c2cb1d79f3f504.tar.bz2 binaryen-64bfe1d84db6c0b9b63aa27bb2c2cb1d79f3f504.zip |
function numbering fix in wasm-s-parser
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r-- | src/wasm-s-parser.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index b53ee44b5..f9a43e69b 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -304,12 +304,17 @@ public: binaryBuilder.read(); return; } + Index implementedFunctions = 0; functionCounter = 0; for (unsigned j = i; j < module.size(); j++) { - preParseFunctionType(*module[j]); - preParseImports(*module[j]); + auto& s = *module[j]; + preParseFunctionType(s); + preParseImports(s); + if (s[0]->str() == FUNC && !isImport(s)) { + implementedFunctions++; + } } - functionCounter = 0; + functionCounter -= implementedFunctions; // we go through the functions again, now parsing them, and the counter begins from where imports ended for (unsigned j = i; j < module.size(); j++) { parseModuleElement(*module[j]); } |