This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 972cf838ca73282ac369d02327d4338e7a44cf79
Author: Josh Tynjala <[email protected]>
AuthorDate: Tue Sep 17 14:37:08 2024 -0700

    ConstantLogic: optimize with an else if instead of two ifs
---
 .../compiler/internal/as/codegen/ConstantLogic.jbg | 32 +++++++++++-----------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git 
a/compiler/src/main/jburg/org/apache/royale/compiler/internal/as/codegen/ConstantLogic.jbg
 
b/compiler/src/main/jburg/org/apache/royale/compiler/internal/as/codegen/ConstantLogic.jbg
index 2ebff2625..9089a1154 100644
--- 
a/compiler/src/main/jburg/org/apache/royale/compiler/internal/as/codegen/ConstantLogic.jbg
+++ 
b/compiler/src/main/jburg/org/apache/royale/compiler/internal/as/codegen/ConstantLogic.jbg
@@ -129,7 +129,7 @@
         String numberType = l instanceof Integer ? "int" : "Number";
         recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, 
numberType, "null"));
     }
-    if (r == UNDEFINED_VALUE)
+    else if (r == UNDEFINED_VALUE)
     {
         recordError(new IllogicalComparisonWithUndefinedProblem(__p));
     }
@@ -144,7 +144,7 @@
         String numberType = r instanceof Integer ? "int" : "Number";
         recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, 
numberType, "null"));
     }
-    if (l == UNDEFINED_VALUE)
+    else if (l == UNDEFINED_VALUE)
     {
         recordError(new IllogicalComparisonWithUndefinedProblem(__p));
     }
@@ -214,7 +214,7 @@
         String numberType = l instanceof Integer ? "int" : "Number";
         recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, 
numberType, "null"));
     }
-    if (r == UNDEFINED_VALUE)
+    else if (r == UNDEFINED_VALUE)
     {
         recordError(new IllogicalComparisonWithUndefinedProblem(__p));
     }
@@ -229,7 +229,7 @@
         String numberType = r instanceof Integer ? "int" : "Number";
         recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, 
numberType, "null"));
     }
-    if (l == UNDEFINED_VALUE)
+    else if (l == UNDEFINED_VALUE)
     {
         recordError(new IllogicalComparisonWithUndefinedProblem(__p));
     }
@@ -296,7 +296,7 @@
         String numberType = l instanceof Integer ? "int" : "Number";
         recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, 
numberType, "null"));
     }
-    if (r == UNDEFINED_VALUE)
+    else if (r == UNDEFINED_VALUE)
     {
         recordError(new IllogicalComparisonWithUndefinedProblem(__p));
     }
@@ -311,7 +311,7 @@
         String numberType = r instanceof Integer ? "int" : "Number";
         recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, 
numberType, "null"));
     }
-    if (l == UNDEFINED_VALUE)
+    else if (l == UNDEFINED_VALUE)
     {
         recordError(new IllogicalComparisonWithUndefinedProblem(__p));
     }
@@ -380,7 +380,7 @@
         String numberType = l instanceof Integer ? "int" : "Number";
         recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, 
numberType, "null"));
     }
-    if (r == UNDEFINED_VALUE)
+    else if (r == UNDEFINED_VALUE)
     {
         recordError(new IllogicalComparisonWithUndefinedProblem(__p));
     }
@@ -395,7 +395,7 @@
         String numberType = r instanceof Integer ? "int" : "Number";
         recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, 
numberType, "null"));
     }
-    if (l == UNDEFINED_VALUE)
+    else if (l == UNDEFINED_VALUE)
     {
         recordError(new IllogicalComparisonWithUndefinedProblem(__p));
     }
@@ -422,7 +422,7 @@
         String numberType = l instanceof Integer ? "int" : "Number";
         recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, 
numberType, "null"));
     }
-    if (r == UNDEFINED_VALUE)
+    else if (r == UNDEFINED_VALUE)
     {
         recordError(new IllogicalComparisonWithUndefinedProblem(__p));
     }
@@ -437,7 +437,7 @@
         String numberType = r instanceof Integer ? "int" : "Number";
         recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, 
numberType, "null"));
     }
-    if (l == UNDEFINED_VALUE)
+    else if (l == UNDEFINED_VALUE)
     {
         recordError(new IllogicalComparisonWithUndefinedProblem(__p));
     }
@@ -464,7 +464,7 @@
         String numberType = l instanceof Integer ? "int" : "Number";
         recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, 
numberType, "null"));
     }
-    if (r == UNDEFINED_VALUE)
+    else if (r == UNDEFINED_VALUE)
     {
         recordError(new IllogicalComparisonWithUndefinedProblem(__p));
     }
@@ -479,7 +479,7 @@
         String numberType = r instanceof Integer ? "int" : "Number";
         recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, 
numberType, "null"));
     }
-    if (l == UNDEFINED_VALUE)
+    else if (l == UNDEFINED_VALUE)
     {
         recordError(new IllogicalComparisonWithUndefinedProblem(__p));
     }
@@ -506,7 +506,7 @@
         String numberType = l instanceof Integer ? "int" : "Number";
         recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, 
numberType, "null"));
     }
-    if (r == UNDEFINED_VALUE)
+    else if (r == UNDEFINED_VALUE)
     {
         recordError(new IllogicalComparisonWithUndefinedProblem(__p));
     }
@@ -521,7 +521,7 @@
         String numberType = r instanceof Integer ? "int" : "Number";
         recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, 
numberType, "null"));
     }
-    if (l == UNDEFINED_VALUE)
+    else if (l == UNDEFINED_VALUE)
     {
         recordError(new IllogicalComparisonWithUndefinedProblem(__p));
     }
@@ -548,7 +548,7 @@
         String numberType = l instanceof Integer ? "int" : "Number";
         recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, 
numberType, "null"));
     }
-    if (r == UNDEFINED_VALUE)
+    else if (r == UNDEFINED_VALUE)
     {
         recordError(new IllogicalComparisonWithUndefinedProblem(__p));
     }
@@ -563,7 +563,7 @@
         String numberType = r instanceof Integer ? "int" : "Number";
         recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, 
numberType, "null"));
     }
-    if (l == UNDEFINED_VALUE)
+    else if (l == UNDEFINED_VALUE)
     {
         recordError(new IllogicalComparisonWithUndefinedProblem(__p));
     }

Reply via email to