From c3b8bf688add81f59e81857b3179da5cdde83462 Mon Sep 17 00:00:00 2001 From: Frotty Date: Sat, 26 May 2018 00:30:52 +0200 Subject: [PATCH] fix exitwhen rewrite --- .../wurstscript/intermediatelang/optimizer/SimpleRewrites.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/optimizer/SimpleRewrites.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/optimizer/SimpleRewrites.java index 20aba45cf..2f443da71 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/optimizer/SimpleRewrites.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/optimizer/SimpleRewrites.java @@ -102,9 +102,8 @@ private void optimizeElement(Element elem) { } private void optimizeConsecutiveExitWhen(ImExitwhen lookback, ImExitwhen element) { - lookback.getCondition().setParent(null); element.getCondition().setParent(null); - lookback.getCondition().replaceBy(JassIm.ImOperatorCall(WurstOperator.OR, JassIm.ImExprs(lookback.getCondition(), element.getCondition()))); + lookback.setCondition(JassIm.ImOperatorCall(WurstOperator.OR, JassIm.ImExprs(lookback.getCondition().copy(), element.getCondition()))); element.replaceBy(JassIm.ImNull()); totalRewrites++; }