number temp variables for each function separately, don't use reserved __
authorJuerg Billeter <j@bitron.ch>
Fri, 31 Aug 2007 11:35:44 +0000 (11:35 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Fri, 31 Aug 2007 11:35:44 +0000 (11:35 +0000)
2007-08-31  Juerg Billeter  <j@bitron.ch>

* gobject/valacodegenerator.vala, gobject/valacodegeneratormethod.vala:
  number temp variables for each function separately, don't use reserved
  __ prefix

svn path=/trunk/; revision=553

ChangeLog
gobject/valacodegenerator.vala
gobject/valacodegeneratormethod.vala

index 1236b0f..70d0f0c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2007-08-31  Jürg Billeter  <j@bitron.ch>
 
+       * gobject/valacodegenerator.vala, gobject/valacodegeneratormethod.vala:
+         number temp variables for each function separately, don't use reserved
+         __ prefix
+
+2007-08-31  Jürg Billeter  <j@bitron.ch>
+
        * gobject/valacodegenerator.vala: simplify struct variable
          initialization, remove unnecessary warning
 
index 08964bc..2670577 100644 (file)
@@ -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;
index f4048fc..702b195 100644 (file)
@@ -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;