From: Jürg Billeter Date: Tue, 16 Dec 2008 22:12:04 +0000 (+0000) Subject: Fix temporary variable handling when using methods defined in VAPI files X-Git-Tag: VALA_0_5_3~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a46fcbbc370b7626ac876a91758eccaf3db6738f;p=thirdparty%2Fvala.git Fix temporary variable handling when using methods defined in VAPI files 2008-12-16 Jürg Billeter * gobject/valaccodebasemodule.vala: * gobject/valaccodemethodmodule.vala: Fix temporary variable handling when using methods defined in VAPI files svn path=/trunk/; revision=2192 --- diff --git a/ChangeLog b/ChangeLog index d694ba601..451987771 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-12-16 Jürg Billeter + + * gobject/valaccodebasemodule.vala: + * gobject/valaccodemethodmodule.vala: + + Fix temporary variable handling when using methods defined in + VAPI files + 2008-12-16 Jürg Billeter * vapigen/valagidlparser.vala: diff --git a/gobject/valaccodebasemodule.vala b/gobject/valaccodebasemodule.vala index 981b0f186..bfc3008f2 100644 --- a/gobject/valaccodebasemodule.vala +++ b/gobject/valaccodebasemodule.vala @@ -139,7 +139,7 @@ public class Vala.CCodeBaseModule : CCodeModule { public Set wrappers; - Map variable_name_map = new HashMap (str_hash, str_equal); + public Map variable_name_map = new HashMap (str_hash, str_equal); public CCodeBaseModule (CCodeGenerator codegen, CCodeModule? next) { base (codegen, next); @@ -282,6 +282,7 @@ public class Vala.CCodeBaseModule : CCodeModule { user_marshal_set = new HashSet (str_hash, str_equal); next_temp_var_id = 0; + variable_name_map.clear (); string_h_needed = false; gvaluecollector_h_needed = false; @@ -1032,11 +1033,14 @@ public class Vala.CCodeBaseModule : CCodeModule { check_type (prop.property_type); int old_next_temp_var_id = next_temp_var_id; + var old_variable_name_map = variable_name_map; next_temp_var_id = 0; + variable_name_map = new HashMap (str_hash, str_equal); prop.accept_children (codegen); next_temp_var_id = old_next_temp_var_id; + variable_name_map = old_variable_name_map; var cl = prop.parent_symbol as Class; if (cl != null && cl.is_subtype_of (gobject_type) diff --git a/gobject/valaccodemethodmodule.vala b/gobject/valaccodemethodmodule.vala index 459cb4e01..bfd2b77c7 100644 --- a/gobject/valaccodemethodmodule.vala +++ b/gobject/valaccodemethodmodule.vala @@ -62,6 +62,7 @@ public class Vala.CCodeMethodModule : CCodeStructModule { DataType 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; + var old_variable_name_map = variable_name_map; if (m.parent_symbol is TypeSymbol) { current_type_symbol = (TypeSymbol) m.parent_symbol; } @@ -70,6 +71,7 @@ public class Vala.CCodeMethodModule : CCodeStructModule { current_return_type = m.return_type; current_method_inner_error = false; next_temp_var_id = 0; + variable_name_map = new HashMap (str_hash, str_equal); bool in_gtypeinstance_creation_method = false; bool in_gobject_creation_method = false; @@ -160,6 +162,7 @@ public class Vala.CCodeMethodModule : CCodeStructModule { current_return_type = old_return_type; current_method_inner_error = old_method_inner_error; next_temp_var_id = old_next_temp_var_id; + variable_name_map = old_variable_name_map; function = new CCodeFunction (m.get_real_cname (), get_creturn_type (m, creturn_type.get_cname ())); m.ccodenode = function;