From: Juerg Billeter Date: Tue, 18 Dec 2007 15:49:14 +0000 (+0000) Subject: support cname attribute for constants X-Git-Tag: VALA_0_1_6~87 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=87c35ff9fcb359df72a3034b213143ccc83bfd35;p=platform%2Fupstream%2Fvala.git support cname attribute for constants 2007-12-18 Juerg Billeter * vala/parser.y, vala/valaattributeprocessor.vala, vala/valaconstant.vala: support cname attribute for constants svn path=/trunk/; revision=780 --- diff --git a/ChangeLog b/ChangeLog index c2a6a7b..870d2e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2007-12-18 Jürg Billeter + * vala/parser.y, vala/valaattributeprocessor.vala, + vala/valaconstant.vala: support cname attribute for constants + +2007-12-18 Jürg Billeter + * vala/parser.y: support PointerType for parameters 2007-12-16 Jürg Billeter diff --git a/vala/parser.y b/vala/parser.y index a2311c8..191c37e 100644 --- a/vala/parser.y +++ b/vala/parser.y @@ -2798,6 +2798,7 @@ constant_declaration if ($3 != 0) { vala_symbol_set_access (VALA_SYMBOL ($$), $3); } + VALA_CODE_NODE($$)->attributes = $2; } ; diff --git a/vala/valaattributeprocessor.vala b/vala/valaattributeprocessor.vala index e392a6a..d6a2f07 100644 --- a/vala/valaattributeprocessor.vala +++ b/vala/valaattributeprocessor.vala @@ -86,6 +86,10 @@ public class Vala.AttributeProcessor : CodeVisitor { cb.process_attributes (); } + public override void visit_constant (Constant! c) { + c.process_attributes (); + } + public override void visit_field (Field! f) { f.process_attributes (); } diff --git a/vala/valaconstant.vala b/vala/valaconstant.vala index 007341f..7c7101c 100644 --- a/vala/valaconstant.vala +++ b/vala/valaconstant.vala @@ -104,4 +104,27 @@ public class Vala.Constant : Member, Lockable { type_reference = new_type; } } + + private void process_ccode_attribute (Attribute! a) { + if (a.has_argument ("cname")) { + cname = a.get_string ("cname"); + } + if (a.has_argument ("cheader_filename")) { + var val = a.get_string ("cheader_filename"); + foreach (string filename in val.split (",")) { + add_cheader_filename (filename); + } + } + } + + /** + * Process all associated attributes. + */ + public void process_attributes () { + foreach (Attribute a in attributes) { + if (a.name == "CCode") { + process_ccode_attribute (a); + } + } + } }