diff options
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]); } |