From 299485eb96b578ab39a5c4b43a9cc2104ca8591d Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Fri, 17 Mar 2017 17:19:28 +0300 Subject: [PATCH] Fix bug in generation of block labels --- .../teavm/backend/javascript/rendering/StatementRenderer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/teavm/backend/javascript/rendering/StatementRenderer.java b/core/src/main/java/org/teavm/backend/javascript/rendering/StatementRenderer.java index ab088d7ce..68d684967 100644 --- a/core/src/main/java/org/teavm/backend/javascript/rendering/StatementRenderer.java +++ b/core/src/main/java/org/teavm/backend/javascript/rendering/StatementRenderer.java @@ -315,7 +315,7 @@ public class StatementRenderer implements ExprVisitor, StatementVisitor { private String generateBlockId(int index) { int mappedIndex; while (blockIds.size() <= index) { - mappedIndex = blockIndexMap.isEmpty() ? -1 : blockIndexMap.get(blockIds.size()); + mappedIndex = blockIndexMap.isEmpty() ? -1 : blockIndexMap.get(blockIds.size() - 1); mappedIndex++; while (RenderingUtil.KEYWORDS.contains(RenderingUtil.indexToId(mappedIndex))) { mappedIndex++;