[vala] girwriter: Skip methods with va_list parameters



commit 1b34d0803e342208f438671b733c4daee7993178
Author: Jürg Billeter <j bitron ch>
Date:   Wed Mar 23 14:00:23 2011 +0100

    girwriter: Skip methods with va_list parameters
    
    gobject-introspection does not currently support va_list parameters.

 codegen/valagirwriter.vala |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 99b34ac..1776767 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -1,6 +1,6 @@
 /* valagirwriter.vala
  *
- * Copyright (C) 2008-2010  Jürg Billeter
+ * Copyright (C) 2008-2011  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -733,6 +733,11 @@ public class Vala.GIRWriter : CodeVisitor {
 			return;
 		}
 
+		// check for unsupported types
+		if (!check_signature (m)) {
+			return;
+		}
+
 		string tag_name = "method";
 		var parent = this.hierarchy.get (0);
 		if (parent is Enum) {
@@ -751,6 +756,27 @@ public class Vala.GIRWriter : CodeVisitor {
 		}
 	}
 
+	bool check_type (DataType type) {
+		// gobject-introspection does not currently support va_list parameters
+		if (type.get_cname () == "va_list") {
+			return false;
+		}
+
+		return true;
+	}
+
+	bool check_signature (Method m) {
+		if (!check_type (m.return_type)) {
+			return false;
+		}
+		foreach (var param in m.get_parameters ()) {
+			if (param.variable_type == null || !check_type (param.variable_type)) {
+				return false;
+			}
+		}
+		return true;
+	}
+
 	private void write_signature (Method m, string tag_name, bool instance = false) {
 		var parent = this.hierarchy.get (0);
 		string name;



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