]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Fix definition of property getter for SimpleType structs
authorLuca Bruno <lucabru@src.gnome.org>
Fri, 24 Jun 2011 05:11:51 +0000 (01:11 -0400)
committerLuca Bruno <lucabru@src.gnome.org>
Tue, 30 Aug 2011 08:16:06 +0000 (10:16 +0200)
Based on patch by Nathan Summers.

Partially fixes bug 657346.

codegen/valaccodebasemodule.vala
codegen/valaccodememberaccessmodule.vala

index 3e5c125ca985249e710ce07b70dcb8865e0e84f7..c9d141739e8c973e73d838b1d7d70081923fd7e8 100644 (file)
@@ -1362,7 +1362,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        var this_type = get_data_type_for_symbol (t);
                        generate_type_declaration (this_type, decl_space);
                        var cselfparam = new CCodeParameter ("self", get_ccode_name (this_type));
-                       if (t is Struct) {
+                       if (t is Struct && !((Struct) t).is_simple_type ()) {
                                cselfparam.type_name += "*";
                        }
 
@@ -1450,7 +1450,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                var this_type = get_data_type_for_symbol (t);
                var cselfparam = new CCodeParameter ("self", get_ccode_name (this_type));
-               if (t is Struct) {
+               if (t is Struct && !((Struct) t).is_simple_type ()) {
                        cselfparam.type_name += "*";
                }
                CCodeParameter cvalueparam;
index 2978ce8cface3b27e46d8fe243a372b66c4679c0..349a96ead1fe4f2e40b2ffdd3416dfba5383f462 100644 (file)
@@ -209,7 +209,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                                var ccall = new CCodeFunctionCall (new CCodeIdentifier (getter_cname));
 
                                if (prop.binding == MemberBinding.INSTANCE) {
-                                       if (prop.parent_symbol is Struct) {
+                                       if (prop.parent_symbol is Struct && !((Struct) prop.parent_symbol).is_simple_type ()) {
                                                // we need to pass struct instance by reference
                                                var instance = expr.inner.target_value;
                                                if (!get_lvalue (instance)) {