From: Juerg Billeter Date: Fri, 31 Aug 2007 11:35:44 +0000 (+0000) Subject: number temp variables for each function separately, don't use reserved __ X-Git-Tag: VALA_0_1_3~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e9cdfe93856307aad067a7b7b1348676734d0ff4;p=platform%2Fupstream%2Fvala.git number temp variables for each function separately, don't use reserved __ 2007-08-31 Juerg Billeter * gobject/valacodegenerator.vala, gobject/valacodegeneratormethod.vala: number temp variables for each function separately, don't use reserved __ prefix svn path=/trunk/; revision=553 --- diff --git a/ChangeLog b/ChangeLog index 1236b0f..70d0f0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-08-31 Jürg Billeter + * gobject/valacodegenerator.vala, gobject/valacodegeneratormethod.vala: + number temp variables for each function separately, don't use reserved + __ prefix + +2007-08-31 Jürg Billeter + * gobject/valacodegenerator.vala: simplify struct variable initialization, remove unnecessary warning diff --git a/gobject/valacodegenerator.vala b/gobject/valacodegenerator.vala index 08964bc..2670577 100644 --- a/gobject/valacodegenerator.vala +++ b/gobject/valacodegenerator.vala @@ -528,8 +528,13 @@ public class Vala.CodeGenerator : CodeVisitor { } public override void visit_property (Property! prop) { + int old_next_temp_var_id = next_temp_var_id; + next_temp_var_id = 0; + prop.accept_children (this); + next_temp_var_id = old_next_temp_var_id; + if (prop.parent_symbol is Class) { prop_enum.add_value (prop.get_upper_case_cname (), null); } @@ -916,7 +921,7 @@ public class Vala.CodeGenerator : CodeVisitor { } private VariableDeclarator get_temp_variable_declarator (TypeReference! type, bool takes_ownership = true) { - var decl = new VariableDeclarator ("__temp%d".printf (next_temp_var_id)); + var decl = new VariableDeclarator ("_tmp%d".printf (next_temp_var_id)); decl.type_reference = type.copy (); decl.type_reference.is_ref = false; decl.type_reference.is_out = false; diff --git a/gobject/valacodegeneratormethod.vala b/gobject/valacodegeneratormethod.vala index f4048fc..702b195 100644 --- a/gobject/valacodegeneratormethod.vala +++ b/gobject/valacodegeneratormethod.vala @@ -29,10 +29,12 @@ public class Vala.CodeGenerator { Method old_method = current_method; TypeReference old_return_type = current_return_type; bool old_method_inner_error = current_method_inner_error; + int old_next_temp_var_id = next_temp_var_id; current_symbol = m; current_method = m; current_return_type = m.return_type; current_method_inner_error = false; + next_temp_var_id = 0; if (m is CreationMethod) { in_creation_method = true; @@ -82,6 +84,7 @@ public class Vala.CodeGenerator { current_method = current_method; current_return_type = old_return_type; current_method_inner_error = old_method_inner_error; + next_temp_var_id = old_next_temp_var_id; if (current_type_symbol != null && current_type_symbol is Interface) { var iface = (Interface) current_type_symbol;