[vala] Fix const-incorrect code generated for string interface properties getters



commit 2eb63927860494cd0a31ee7a747817501b6043de
Author: Ali Sabil <ali sabil gmail com>
Date:   Mon Apr 6 18:50:29 2009 +0200

    Fix const-incorrect code generated for string interface properties getters
    
    Fixes bug 577960.
---
 gobject/valaccodebasemodule.vala |    2 +-
 gobject/valagtypemodule.vala     |   17 +++++++++--------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/gobject/valaccodebasemodule.vala b/gobject/valaccodebasemodule.vala
index 20a8f02..9aa3f45 100644
--- a/gobject/valaccodebasemodule.vala
+++ b/gobject/valaccodebasemodule.vala
@@ -1151,7 +1151,7 @@ internal class Vala.CCodeBaseModule : CCodeModule {
 
 		var old_return_type = current_return_type;
 		if (acc.readable && !returns_real_struct) {
-			current_return_type = prop.property_type;
+			current_return_type = acc.value_type;
 		} else {
 			current_return_type = new VoidType ();
 		}
diff --git a/gobject/valagtypemodule.vala b/gobject/valagtypemodule.vala
index 41e619f..5b0aad5 100644
--- a/gobject/valagtypemodule.vala
+++ b/gobject/valagtypemodule.vala
@@ -93,22 +93,17 @@ internal class Vala.GTypeModule : GErrorModule {
 
 			var this_type = new ObjectType (t);
 			var cselfparam = new CCodeFormalParameter ("self", this_type.get_cname ());
-			CCodeFormalParameter cvalueparam;
-			if (returns_real_struct) {
-				cvalueparam = new CCodeFormalParameter ("value", prop.property_type.get_cname () + "*");
-			} else {
-				cvalueparam = new CCodeFormalParameter ("value", prop.property_type.get_cname ());
-			}
 
 			if (prop.get_accessor != null) {
 				var vdeclarator = new CCodeFunctionDeclarator ("get_%s".printf (prop.name));
 				vdeclarator.add_parameter (cselfparam);
 				string creturn_type;
 				if (returns_real_struct) {
+					var cvalueparam = new CCodeFormalParameter ("value", prop.get_accessor.value_type.get_cname () + "*");
 					vdeclarator.add_parameter (cvalueparam);
 					creturn_type = "void";
 				} else {
-					creturn_type = prop.property_type.get_cname ();
+					creturn_type = prop.get_accessor.value_type.get_cname ();
 				}
 				var vdecl = new CCodeDeclaration (creturn_type);
 				vdecl.add_declarator (vdeclarator);
@@ -117,7 +112,13 @@ internal class Vala.GTypeModule : GErrorModule {
 			if (prop.set_accessor != null) {
 				var vdeclarator = new CCodeFunctionDeclarator ("set_%s".printf (prop.name));
 				vdeclarator.add_parameter (cselfparam);
-				vdeclarator.add_parameter (cvalueparam);
+				if (returns_real_struct) {
+					var cvalueparam = new CCodeFormalParameter ("value", prop.set_accessor.value_type.get_cname () + "*");
+					vdeclarator.add_parameter (cvalueparam);
+				} else {
+					var cvalueparam = new CCodeFormalParameter ("value", prop.set_accessor.value_type.get_cname ());
+					vdeclarator.add_parameter (cvalueparam);
+				}
 				var vdecl = new CCodeDeclaration ("void");
 				vdecl.add_declarator (vdeclarator);
 				type_struct.add_declaration (vdecl);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]