]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
fix object creation for non-GObject classes without creation method
authorJuerg Billeter <j@bitron.ch>
Thu, 30 Aug 2007 14:47:36 +0000 (14:47 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Thu, 30 Aug 2007 14:47:36 +0000 (14:47 +0000)
2007-08-30  Juerg Billeter  <j@bitron.ch>

* gobject/valacodegenerator.vala: fix object creation for non-GObject
  classes without creation method

svn path=/trunk/; revision=539

ChangeLog
gobject/valacodegenerator.vala

index f0caee1f8df91a05e3250fb16be4735daf322f65..93a75d8ee4a8f0b50764746dcd2a3f255da890ab 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-08-30  Jürg Billeter  <j@bitron.ch>
+
+       * gobject/valacodegenerator.vala: fix object creation for non-GObject
+         classes without creation method
+
 2007-08-30  Jürg Billeter  <j@bitron.ch>
 
        * vala/valaclass.vala, gobject/valacodegenerator.vala,
index 264bca248bab5f87c438cad57eda0c9595d68b7f..875b099609e7bc5d456959c69ce833df864577e0 100644 (file)
@@ -2347,7 +2347,11 @@ public class Vala.CodeGenerator : CodeVisitor {
        public override void visit_end_object_creation_expression (ObjectCreationExpression! expr) {
                if (expr.symbol_reference == null) {
                        // no creation method
-                       if (expr.type_reference.data_type is Class) {
+                       if (expr.type_reference.data_type == glist_type ||
+                                  expr.type_reference.data_type == gslist_type) {
+                               // NULL is an empty list
+                               expr.ccodenode = new CCodeConstant ("NULL");
+                       } else if (expr.type_reference.data_type is Class && expr.type_reference.data_type.is_subtype_of (gobject_type)) {
                                var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_object_new"));
                                
                                ccall.add_argument (new CCodeConstant (expr.type_reference.data_type.get_type_id ()));
@@ -2355,10 +2359,6 @@ public class Vala.CodeGenerator : CodeVisitor {
                                ccall.add_argument (new CCodeConstant ("NULL"));
                                
                                expr.ccodenode = ccall;
-                       } else if (expr.type_reference.data_type == glist_type ||
-                                  expr.type_reference.data_type == gslist_type) {
-                               // NULL is an empty list
-                               expr.ccodenode = new CCodeConstant ("NULL");
                        } else {
                                var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_new0"));