]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Prioritize the usage of an existing with-variable instance
authorNick Schrader <nick.schrader@mailbox.org>
Sat, 26 Sep 2020 11:57:13 +0000 (13:57 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 27 Sep 2020 06:48:23 +0000 (08:48 +0200)
vala/valawithstatement.vala

index f873e600c4ace6264daad4f50fee7a74e9ac8e8d..52210284a0e8a844ca9f23bcf619afa8dfaf522e 100644 (file)
@@ -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));
                }