don't create empty dispose functions, support virtual methods with
authorJürg Billeter <j@bitron.ch>
Thu, 26 Oct 2006 12:05:44 +0000 (12:05 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Thu, 26 Oct 2006 12:05:44 +0000 (12:05 +0000)
2006-10-26  Jürg Billeter  <j@bitron.ch>

* vala/valacodegenerator.vala: don't create empty dispose functions,
  support virtual methods with non-void return type
* vapi/glib-2.0.vala: include glib/gstdio.h for GLib file functions

svn path=/trunk/; revision=156

vala/ChangeLog
vala/vala/valacodegenerator.vala
vala/vapi/glib-2.0.vala

index a1fa3f1..1b83680 100644 (file)
@@ -1,5 +1,11 @@
 2006-10-26  Jürg Billeter  <j@bitron.ch>
 
+       * vala/valacodegenerator.vala: don't create empty dispose functions,
+         support virtual methods with non-void return type
+       * vapi/glib-2.0.vala: include glib/gstdio.h for GLib file functions
+
+2006-10-26  Jürg Billeter  <j@bitron.ch>
+
        * vala/valacodegenerator.vala: explicitly cast callbacks to reduce the
          number of warnings during C compilation
 
index 6e910b4..bb7bfe0 100644 (file)
@@ -410,7 +410,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                }
                
                add_instance_init_function (cl);
-               if (memory_management) {
+               if (memory_management && cl.get_fields () != null) {
                        add_dispose_function (cl);
                }
                
@@ -1273,7 +1273,12 @@ public class Vala.CodeGenerator : CodeVisitor {
                                vcall.add_argument (new CCodeIdentifier (param.name));
                        }
 
-                       vblock.add_statement (new CCodeExpressionStatement (vcall));
+                       if (m.return_type.data_type == null) {
+                               vblock.add_statement (new CCodeExpressionStatement (vcall));
+                       } else {
+                               /* pass method return value */
+                               vblock.add_statement (new CCodeReturnStatement (vcall));
+                       }
 
                        header_type_member_declaration.append (vfunc.copy ());
                        
index 632114b..0c74b6e 100644 (file)
@@ -757,7 +757,7 @@ namespace GLib {
        }
        
        [ReferenceType (free_function = "fclose")]
-       [CCode (cname = "FILE", cheader_filename = "stdio.h")]
+       [CCode (cname = "FILE", cheader_filename = "stdio.h,glib/gstdio.h")]
        public struct File {
                [CCode (cname = "fopen")]
                public static ref File open (string path, string mode);