From: Nick Schrader Date: Sat, 26 Sep 2020 11:57:13 +0000 (+0200) Subject: vala: Prioritize the usage of an existing with-variable instance X-Git-Tag: 0.50.1~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b277482943639a1b4fa0bc8db7dd577b61d70042;p=thirdparty%2Fvala.git vala: Prioritize the usage of an existing with-variable instance --- 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)); }