Commit e9cdfe93 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter
Browse files

number temp variables for each function separately, don't use reserved __

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
parent 5fe3ca9a
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
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment