From 8acd94fc89d38ee543e755aaac024a49695a6c87 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sun, 5 Mar 2023 12:07:56 +0100 Subject: [PATCH] avoid work --- compiler/res/version.txt | 2 +- ...NotExpressionAndIfComparisonExprChanger.kt | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/compiler/res/version.txt b/compiler/res/version.txt index 1f250bde9..22ec1e649 100644 --- a/compiler/res/version.txt +++ b/compiler/res/version.txt @@ -1 +1 @@ -8.10-dev +8.10 diff --git a/compiler/src/prog8/compiler/astprocessing/NotExpressionAndIfComparisonExprChanger.kt b/compiler/src/prog8/compiler/astprocessing/NotExpressionAndIfComparisonExprChanger.kt index bff62d575..d133fd0cc 100644 --- a/compiler/src/prog8/compiler/astprocessing/NotExpressionAndIfComparisonExprChanger.kt +++ b/compiler/src/prog8/compiler/astprocessing/NotExpressionAndIfComparisonExprChanger.kt @@ -153,17 +153,6 @@ internal class NotExpressionAndIfComparisonExprChanger(val program: Program, val if(compTarget.name == VMTarget.NAME) // don't apply this optimization for Vm target return CondExprSimplificationResult(null, null, null, null) - var leftAssignment: Assignment? = null - var leftOperandReplacement: Expression? = null - var rightAssignment: Assignment? = null - var rightOperandReplacement: Expression? = null - - val separateLeftExpr = !expr.left.isSimple - && expr.left !is IFunctionCall - && expr.left !is ContainmentCheck - val separateRightExpr = !expr.right.isSimple - && expr.right !is IFunctionCall - && expr.right !is ContainmentCheck val leftDt = expr.left.inferType(program) val rightDt = expr.right.inferType(program) @@ -172,6 +161,17 @@ internal class NotExpressionAndIfComparisonExprChanger(val program: Program, val return CondExprSimplificationResult(null, null, null, null) } + var leftAssignment: Assignment? = null + var leftOperandReplacement: Expression? = null + var rightAssignment: Assignment? = null + var rightOperandReplacement: Expression? = null + val separateLeftExpr = !expr.left.isSimple + && expr.left !is IFunctionCall + && expr.left !is ContainmentCheck + val separateRightExpr = !expr.right.isSimple + && expr.right !is IFunctionCall + && expr.right !is ContainmentCheck + if(separateLeftExpr) { val name = getTempRegisterName(leftDt) leftOperandReplacement = IdentifierReference(name, expr.position)