Wasm backend: write function index in AST representation to make easier navigation and debugging

This commit is contained in:
Alexey Andreev 2018-05-17 19:39:22 +03:00
parent c58e19405c
commit dbe31c43bf

View File

@ -57,14 +57,15 @@ public class WasmRenderer {
visitor.open().append("module"); visitor.open().append("module");
renderTypes(module); renderTypes(module);
int functionIndex = 0;
for (WasmFunction function : module.getFunctions().values()) { for (WasmFunction function : module.getFunctions().values()) {
if (function.getImportName() != null) { if (function.getImportName() != null) {
lf().render(function); lf().append(";; function #" + functionIndex++).lf().render(function);
} }
} }
for (WasmFunction function : module.getFunctions().values()) { for (WasmFunction function : module.getFunctions().values()) {
if (function.getImportName() == null) { if (function.getImportName() == null) {
lf().render(function); lf().append(";; function #" + functionIndex++).lf().render(function);
} }
} }