]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girwriter: Skip methods with va_list parameters
authorJürg Billeter <j@bitron.ch>
Wed, 23 Mar 2011 13:00:23 +0000 (14:00 +0100)
committerJürg Billeter <j@bitron.ch>
Wed, 23 Mar 2011 13:00:23 +0000 (14:00 +0100)
gobject-introspection does not currently support va_list parameters.

codegen/valagirwriter.vala

index 99b34ac7f1a101483e827475ce09d8d7b494e5d0..177676772f5d4a4ad2aa5d322b541ae5fda02bee 100644 (file)
@@ -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;