]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
fix invalid C code for virtual interface method implementations
authorJuerg Billeter <j@bitron.ch>
Wed, 12 Dec 2007 16:39:59 +0000 (16:39 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Wed, 12 Dec 2007 16:39:59 +0000 (16:39 +0000)
2007-12-12  Juerg Billeter  <j@bitron.ch>

* gobject/valaccodegeneratormethod.vala: fix invalid C code for virtual
  interface method implementations

* tests/interfaces.exp, tests/interfaces.vala: test virtual interface
  method implementations

svn path=/trunk/; revision=763

ChangeLog
gobject/valaccodegeneratormethod.vala
tests/interfaces.exp
tests/interfaces.vala

index fee27f8e8f4380d2d5695fa5e68ddbfa590cb4a4..bfb4487acf9c15adcdaf120c31aaae5cf84d78e0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-12-12  Jürg Billeter  <j@bitron.ch>
+
+       * gobject/valaccodegeneratormethod.vala: fix invalid C code for virtual
+         interface method implementations
+
+       * tests/interfaces.exp, tests/interfaces.vala: test virtual interface
+         method implementations
+
 2007-12-12  Jürg Billeter  <j@bitron.ch>
 
        * vala/parser.y, vala/scanner.l, vala/valadatatype.vala,
index 6251d1c80b35bdbf1654b7bc7458c69be04e3926..c69db54b420e37d27dceb9cff96cf7bc58757ba4 100644 (file)
@@ -243,7 +243,7 @@ public class Vala.CCodeGenerator {
 
                                if (m.parent_symbol is Class) {
                                        var cl = (Class) m.parent_symbol;
-                                       if (m.overrides || m.base_interface_method != null) {
+                                       if (m.overrides || (m.base_interface_method != null && !m.is_abstract && !m.is_virtual)) {
                                                Method base_method;
                                                if (m.overrides) {
                                                        base_method = m.base_method;
index 837ce79aa08ea4686cdcf74422219aa8cfba82be..388004fe92377879a1f9969266e27f6059ce7eb3 100644 (file)
@@ -1 +1 @@
-Interface Test: 1 2 3
+Interface Test: 1 2 3 4 5 6 7
index d269ad6596fac19bdbe3e4bb7e6dd8c85f9ca6a8..7eb652e3fcf52e17c7f78fd98ecd282b0937bcd4 100644 (file)
@@ -2,6 +2,8 @@ using GLib;
 
 interface Maman.Ibaz : Object {
        public abstract void do_action ();
+
+       public abstract void do_virtual_action ();
 }
 
 class Maman.Baz : Object, Ibaz {
@@ -9,13 +11,32 @@ class Maman.Baz : Object, Ibaz {
                stdout.printf (" 2");
        }
 
+       public virtual void do_virtual_action () {
+               stdout.printf (" 4");
+       }
+}
+
+class Maman.SubBaz : Baz {
+       public override void do_virtual_action () {
+               stdout.printf (" 6");
+       }
+
        static int main (string[] args) {
                stdout.printf ("Interface Test: 1");
 
                Ibaz ibaz = new Baz ();
                ibaz.do_action ();
        
-               stdout.printf (" 3\n");
+               stdout.printf (" 3");
+
+               ibaz.do_virtual_action ();
+
+               stdout.printf (" 5");
+
+               Ibaz subbaz = new SubBaz ();
+               subbaz.do_virtual_action ();
+
+               stdout.printf (" 7\n");
 
                return 0;
        }