diff --git a/core/src/main/java/org/teavm/backend/wasm/render/WasmRenderer.java b/core/src/main/java/org/teavm/backend/wasm/render/WasmRenderer.java index 3c421a4c7..e30642ec4 100644 --- a/core/src/main/java/org/teavm/backend/wasm/render/WasmRenderer.java +++ b/core/src/main/java/org/teavm/backend/wasm/render/WasmRenderer.java @@ -57,14 +57,15 @@ public class WasmRenderer { visitor.open().append("module"); renderTypes(module); + int functionIndex = 0; for (WasmFunction function : module.getFunctions().values()) { if (function.getImportName() != null) { - lf().render(function); + lf().append(";; function #" + functionIndex++).lf().render(function); } } for (WasmFunction function : module.getFunctions().values()) { if (function.getImportName() == null) { - lf().render(function); + lf().append(";; function #" + functionIndex++).lf().render(function); } }