From: Juerg Billeter Date: Sat, 10 May 2008 14:55:38 +0000 (+0000) Subject: Support cname attribute for enum values, patch by Jared Moore, fixes bug X-Git-Tag: VALA_0_3_2~30 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6ccf1501ac858ddf0f5ba70f2c213940be3457a8;p=thirdparty%2Fvala.git Support cname attribute for enum values, patch by Jared Moore, fixes bug 2008-05-10 Juerg Billeter * vala/valaattributeprocessor.vala: * vala/valaenumvalue.vala: Support cname attribute for enum values, patch by Jared Moore, fixes bug 529288 svn path=/trunk/; revision=1353 --- diff --git a/ChangeLog b/ChangeLog index bd54a5f4b..5c08f11fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-05-10 Jürg Billeter + + * vala/valaattributeprocessor.vala: + * vala/valaenumvalue.vala: + + Support cname attribute for enum values, + patch by Jared Moore, fixes bug 529288 + 2008-05-10 Jürg Billeter * vapi/packages/gtk+-2.0/: diff --git a/vala/valaattributeprocessor.vala b/vala/valaattributeprocessor.vala index d117b42f6..9daaf88c5 100644 --- a/vala/valaattributeprocessor.vala +++ b/vala/valaattributeprocessor.vala @@ -68,6 +68,12 @@ public class Vala.AttributeProcessor : CodeVisitor { public override void visit_enum (Enum en) { en.process_attributes (); + + en.accept_children (this); + } + + public override void visit_enum_value (EnumValue ev) { + ev.process_attributes (); } public override void visit_error_domain (ErrorDomain edomain) { diff --git a/vala/valaenumvalue.vala b/vala/valaenumvalue.vala index 9bfd3f6d8..7ba730687 100644 --- a/vala/valaenumvalue.vala +++ b/vala/valaenumvalue.vala @@ -94,6 +94,18 @@ public class Vala.EnumValue : Symbol { } } + /** + * Process all associated attributes. + */ + public void process_attributes () { + foreach (Attribute a in attributes) { + if (a.name == "CCode" && a.has_argument("cname")) { + cname = a.get_string ("cname"); + } + } + } + + /** * Returns the name of this enum value as it is used in C code. *