[vala] vapigen: Support hidden attribute for signal parameters



commit 80fcabdb47119bca73abf2a3d499958c9ba0a0af
Author: Jürg Billeter <j bitron ch>
Date:   Mon Oct 25 15:30:36 2010 +0200

    vapigen: Support hidden attribute for signal parameters

 vapigen/valagidlparser.vala |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index b8dc293..917c5ae 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -2658,14 +2658,21 @@ public class Vala.GIdlParser : CodeVisitor {
 			var param_type = parse_param (param, out direction);
 			var p = new FormalParameter (param_node.name, param_type);
 			p.direction = direction;
-			sig.add_parameter (p);
 
+			bool hide_param = false;
+			bool show_param = false;
 			attributes = get_attributes ("%s::%s.%s".printf (current_data_type.get_cname (), sig.name, param_node.name));
 			if (attributes != null) {
 				string ns_name = null;
 				foreach (string attr in attributes) {
 					var nv = attr.split ("=", 2);
-					if (nv[0] == "is_array") {
+					if (nv[0] == "hidden") {
+						if (eval (nv[1]) == "1") {
+							hide_param = true;
+						} else if (eval (nv[1]) == "0") {
+							show_param = true;
+						}
+					} else if (nv[0] == "is_array") {
 						if (eval (nv[1]) == "1") {
 							param_type = new ArrayType (param_type, 1, param_type.source_reference);
 							p.variable_type = param_type;
@@ -2706,6 +2713,10 @@ public class Vala.GIdlParser : CodeVisitor {
 					((UnresolvedType) param_type).unresolved_symbol.inner = new UnresolvedSymbol (null, ns_name);
 				}
 			}
+
+			if (show_param || !hide_param) {
+				sig.add_parameter (p);
+			}
 		}
 		
 		return sig;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]