From: Juerg Billeter Date: Wed, 12 Dec 2007 16:39:59 +0000 (+0000) Subject: fix invalid C code for virtual interface method implementations X-Git-Tag: VALA_0_1_6~104 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cc744d6c3eacb7ac38254e4e48d0b175f97f028b;p=platform%2Fupstream%2Fvala.git fix invalid C code for virtual interface method implementations 2007-12-12 Juerg Billeter * 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 --- diff --git a/ChangeLog b/ChangeLog index fee27f8..bfb4487 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2007-12-12 Jürg Billeter + * 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 + * vala/parser.y, vala/scanner.l, vala/valadatatype.vala, vala/valasymbolresolver.vala, vala/valavoidtype.vala: always use VoidType diff --git a/gobject/valaccodegeneratormethod.vala b/gobject/valaccodegeneratormethod.vala index 6251d1c..c69db54 100644 --- a/gobject/valaccodegeneratormethod.vala +++ b/gobject/valaccodegeneratormethod.vala @@ -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; diff --git a/tests/interfaces.exp b/tests/interfaces.exp index 837ce79..388004f 100644 --- a/tests/interfaces.exp +++ b/tests/interfaces.exp @@ -1 +1 @@ -Interface Test: 1 2 3 +Interface Test: 1 2 3 4 5 6 7 diff --git a/tests/interfaces.vala b/tests/interfaces.vala index d269ad6..7eb652e 100644 --- a/tests/interfaces.vala +++ b/tests/interfaces.vala @@ -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; }