diff --git a/core/src/main/java/org/teavm/ast/optimization/OptimizingVisitor.java b/core/src/main/java/org/teavm/ast/optimization/OptimizingVisitor.java index 5007ef45f..6171b349c 100644 --- a/core/src/main/java/org/teavm/ast/optimization/OptimizingVisitor.java +++ b/core/src/main/java/org/teavm/ast/optimization/OptimizingVisitor.java @@ -697,7 +697,9 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor { return false; } optimization.unwrappedArrayVariable = ((VariableExpr) assign.getLeftValue()).getIndex(); - if (writeFrequencies[optimization.unwrappedArrayVariable] != 1) { + if (writeFrequencies[optimization.unwrappedArrayVariable] != 1 + || preservedVars[optimization.unwrappedArrayVariable] + || readFrequencies[optimization.unwrappedArrayVariable] != optimization.arraySize) { return false; } diff --git a/html4j/src/test/java/org/teavm/html4j/test/KnockoutTCKTest.java b/html4j/src/test/java/org/teavm/html4j/test/KnockoutTCKTest.java index 9455677ae..cad0eeeec 100644 --- a/html4j/src/test/java/org/teavm/html4j/test/KnockoutTCKTest.java +++ b/html4j/src/test/java/org/teavm/html4j/test/KnockoutTCKTest.java @@ -21,7 +21,6 @@ import net.java.html.json.tests.KnockoutTest; import net.java.html.json.tests.MinesTest; import net.java.html.json.tests.OperationsTest; import net.java.html.json.tests.WebSocketTest; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.teavm.junit.SkipJVM; @@ -35,7 +34,6 @@ import org.teavm.junit.WholeClassCompilation; @RunWith(TeaVMTestRunner.class) @SkipJVM @WholeClassCompilation -@Ignore public class KnockoutTCKTest { private final ConvertTypesTest convertTypesTest = new ConvertTypesTest(); private final JSONTest jsonTest = new JSONTest();