From a213b6642b18e0fcbe97c7beb3a59e8b808e2baa Mon Sep 17 00:00:00 2001 From: Jared Moore Date: Thu, 14 Aug 2008 09:58:27 +0000 Subject: [PATCH] Fixed codegen of abstract property accessors, bug 547226. 2008-08-14 Jared Moore * gobject/valaccodegenerator.vala: Fixed codegen of abstract property accessors, bug 547226. * tests/classes-properties.vala: * tests/classes-properties.exp: Added test case for abstract property accessors. svn path=/trunk/; revision=1749 --- ChangeLog | 11 +++++++++++ gobject/valaccodegenerator.vala | 1 + tests/classes-properties.exp | 2 +- tests/classes-properties.vala | 11 ++++++++--- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 44c8f8e..27f620b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-08-14 Jared Moore + + * gobject/valaccodegenerator.vala: + + Fixed codegen of abstract property accessors, bug 547226. + + * tests/classes-properties.vala: + * tests/classes-properties.exp: + + Added test case for abstract property accessors. + 2008-08-10 Thijs Vermeir * vapi/packages/gstreamer-0.10/gstreamer-0.10-custom.vala: diff --git a/gobject/valaccodegenerator.vala b/gobject/valaccodegenerator.vala index c9585ef..b4f79f1 100644 --- a/gobject/valaccodegenerator.vala +++ b/gobject/valaccodegenerator.vala @@ -870,6 +870,7 @@ public class Vala.CCodeGenerator : CodeGenerator { var vcall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (vcast, "set_%s".printf (prop.name))); vcall.add_argument (new CCodeIdentifier ("self")); vcall.add_argument (new CCodeIdentifier ("value")); + block.add_statement (new CCodeExpressionStatement (vcall)); } source_type_member_definition.append (function); diff --git a/tests/classes-properties.exp b/tests/classes-properties.exp index 0f43340..33fd113 100644 --- a/tests/classes-properties.exp +++ b/tests/classes-properties.exp @@ -3,4 +3,4 @@ automatic: TheNewAutomatic name: TheNewName read_only: InitialReadOnly automatic: TheNewAutomatic -Property Test: 1 2 3 4 5 6 +Property Test: 1 2 3 4 5 6 7 diff --git a/tests/classes-properties.vala b/tests/classes-properties.vala index 3c011f7..6fec537 100644 --- a/tests/classes-properties.vala +++ b/tests/classes-properties.vala @@ -53,8 +53,7 @@ public class Sample : Object { } } - -class Maman.Foo : Object { +abstract class Maman.Foo : Object { private int _public_base_property = 2; public int public_base_property { get { @@ -64,10 +63,12 @@ class Maman.Foo : Object { _public_base_property = value; } } + public abstract int abstract_base_property { get; set; } } class Maman.Bar : Foo { public int public_property { get; set; default = 3; } + public override int abstract_base_property { get; set; } void do_action () { stdout.printf (" %d %d", public_base_property, public_property); @@ -82,7 +83,11 @@ class Maman.Bar : Foo { var bar = new Bar (); bar.do_action (); - stdout.printf (" 6\n"); + Foo foo = bar; + foo.abstract_base_property = 6; + stdout.printf (" %d", foo.abstract_base_property); + + stdout.printf (" 7\n"); } } -- 2.7.4