[vala/0.36] girparser: Accept setters with boolean return-type as valid property-accessor



commit 2c420d334787ef9405ad85d26ee8b43458c1615b
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Fri Dec 8 08:35:17 2017 +0100

    girparser: Accept setters with boolean return-type as valid property-accessor

 vala/valagirparser.vala |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index cdac233..f06a61b 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1021,7 +1021,7 @@ public class Vala.GirParser : CodeVisitor {
                                                // ensure setter vfunc if the property is abstract
                                                if (m != null) {
                                                        setter.process (parser);
-                                                       if (!(m.return_type is VoidType) || 
m.get_parameters().size != 1) {
+                                                       if (!(m.return_type is VoidType || m.return_type is 
BooleanType) || m.get_parameters().size != 1) {
                                                                prop.set_attribute ("NoAccessorMethod", true);
                                                                prop.set_attribute ("ConcreteAccessor", 
false);
                                                        } else {
@@ -2612,7 +2612,7 @@ public class Vala.GirParser : CodeVisitor {
                no_array_length = false;
                array_null_terminated = false;
 
-               DataType type;
+               DataType? type = null;
                if (type_name == "none") {
                        type = new VoidType (get_current_src ());
                } else if (type_name == "gpointer") {
@@ -2628,7 +2628,7 @@ public class Vala.GirParser : CodeVisitor {
                        if (type_name == "utf8") {
                                type_name = "string";
                        } else if (type_name == "gboolean") {
-                               type_name = "bool";
+                               type = new BooleanType ((Struct) context.root.scope.lookup ("bool"));
                        } else if (type_name == "gchar") {
                                type_name = "char";
                        } else if (type_name == "gshort") {
@@ -2702,10 +2702,13 @@ public class Vala.GirParser : CodeVisitor {
                        } else {
                                known_type = false;
                        }
-                       var sym = parse_symbol_from_string (type_name, get_current_src ());
-                       type = new UnresolvedType.from_symbol (sym, get_current_src ());
-                       if (!known_type) {
-                               unresolved_gir_symbols.add (sym);
+
+                       if (type == null) {
+                               var sym = parse_symbol_from_string (type_name, get_current_src ());
+                               type = new UnresolvedType.from_symbol (sym, get_current_src ());
+                               if (!known_type) {
+                                       unresolved_gir_symbols.add (sym);
+                               }
                        }
                }
 


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