[vala/wip/issue/1043: 1/2] vala: Prioritize the usage of existing with-variable instance




commit 29efcd6503e6c1259a7ac1673533a0b2be5ef809
Author: Nick Schrader <nick schrader mailbox org>
Date:   Sat Sep 26 13:57:13 2020 +0200

    vala: Prioritize the usage of existing with-variable instance

 vala/valawithstatement.vala | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/vala/valawithstatement.vala b/vala/valawithstatement.vala
index f873e600c..52210284a 100644
--- a/vala/valawithstatement.vala
+++ b/vala/valawithstatement.vala
@@ -105,10 +105,10 @@ public class Vala.WithStatement : Block {
 
                var local_var = expression.symbol_reference as LocalVariable;
                if (with_variable != null || local_var == null) {
-                       if (with_variable == null) {
-                               local_var = new LocalVariable (expression.value_type.copy (), get_temp_name 
(), expression, source_reference);
-                       } else {
+                       if (with_variable != null) {
                                local_var = with_variable;
+                       } else {
+                               local_var = new LocalVariable (expression.value_type.copy (), get_temp_name 
(), expression, source_reference);
                        }
                        body.insert_statement (0, new DeclarationStatement (local_var, source_reference));
                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]