]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Support object creation expressions for simple types
authorJürg Billeter <j@bitron.ch>
Fri, 13 Jun 2008 16:40:33 +0000 (16:40 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Fri, 13 Jun 2008 16:40:33 +0000 (16:40 +0000)
2008-06-13  Jürg Billeter  <j@bitron.ch>

* gobject/valaccodegenerator.vala:

Support object creation expressions for simple types

svn path=/trunk/; revision=1577

ChangeLog
gobject/valaccodegenerator.vala

index 20d52cb6e50e94ed597661262a029571519a350b..6b5baa33688d76e2f6d9dcdbb18c1f0a5125eba2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-13  Jürg Billeter  <j@bitron.ch>
+
+       * gobject/valaccodegenerator.vala:
+
+       Support object creation expressions for simple types
+
 2008-06-13  Jürg Billeter  <j@bitron.ch>
 
        * vapi/glib-2.0.vapi:
index d089b1001744c5544c24931bbc764b42cf941ceb..773cc35886d691eb5d32abf9895e325ef08417f5 100644 (file)
@@ -2991,7 +2991,8 @@ public class Vala.CCodeGenerator : CodeGenerator {
                CCodeExpression instance = null;
                CCodeFunctionCall creation_call = null;
 
-               if (expr.type_reference.data_type is Struct || expr.get_object_initializer ().size > 0) {
+               var st = expr.type_reference.data_type as Struct;
+               if ((st != null && !st.is_simple_type ()) || expr.get_object_initializer ().size > 0) {
                        // value-type initialization or object creation expression with object initializer
                        var temp_decl = get_temp_variable (expr.type_reference, false, expr);
                        temp_vars.add (temp_decl);
@@ -3028,7 +3029,7 @@ public class Vala.CCodeGenerator : CodeGenerator {
 
                        creation_call = new CCodeFunctionCall (new CCodeIdentifier (m.get_cname ()));
 
-                       if (expr.type_reference.data_type is Struct && !(m.cinstance_parameter_position < 0)) {
+                       if ((st != null && !st.is_simple_type ()) && !(m.cinstance_parameter_position < 0)) {
                                creation_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, instance));
                        }
 
@@ -3120,7 +3121,7 @@ public class Vala.CCodeGenerator : CodeGenerator {
                                i++;
                        }
 
-                       if (expr.type_reference.data_type is Struct && m.cinstance_parameter_position < 0) {
+                       if ((st != null && !st.is_simple_type ()) && m.cinstance_parameter_position < 0) {
                                // instance parameter is at the end in a struct creation method
                                creation_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, instance));
                        }