diff --git a/teavm-core/src/main/java/org/teavm/javascript/Decompiler.java b/teavm-core/src/main/java/org/teavm/javascript/Decompiler.java index 33d3c3311..59845bef8 100644 --- a/teavm-core/src/main/java/org/teavm/javascript/Decompiler.java +++ b/teavm-core/src/main/java/org/teavm/javascript/Decompiler.java @@ -219,7 +219,7 @@ public class Decompiler { node.getVariables().add(program.variableAt(i).getRegister()); } Optimizer optimizer = new Optimizer(); - optimizer.optimize(node, program, splitter); + optimizer.optimize(node, splitter); node.getModifiers().addAll(mapModifiers(method.getModifiers())); int paramCount = Math.min(method.getSignature().length, program.variableCount()); for (int i = 0; i < paramCount; ++i) { diff --git a/teavm-core/src/main/java/org/teavm/javascript/Optimizer.java b/teavm-core/src/main/java/org/teavm/javascript/Optimizer.java index f69803a48..8b33e82a7 100644 --- a/teavm-core/src/main/java/org/teavm/javascript/Optimizer.java +++ b/teavm-core/src/main/java/org/teavm/javascript/Optimizer.java @@ -43,10 +43,10 @@ public class Optimizer { } } - public void optimize(AsyncMethodNode method, Program program, AsyncProgramSplitter splitter) { + public void optimize(AsyncMethodNode method, AsyncProgramSplitter splitter) { ReadWriteStatsBuilder stats = new ReadWriteStatsBuilder(method.getVariables().size()); - stats.analyze(program); for (int i = 0; i < splitter.size(); ++i) { + stats.analyze(splitter.getProgram(i)); Integer var = splitter.getInput(i); if (var != null) { stats.reads[var]++;