From dbe31c43bf5894161cb2a4e36d9f6a67f5aadd44 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Thu, 17 May 2018 19:39:22 +0300 Subject: [PATCH] Wasm backend: write function index in AST representation to make easier navigation and debugging --- .../java/org/teavm/backend/wasm/render/WasmRenderer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); } }