[vala/0.38] girparser: Accept setters with boolean return-type as valid property-accessor
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.38] girparser: Accept setters with boolean return-type as valid property-accessor
- Date: Sat, 9 Dec 2017 07:51:59 +0000 (UTC)
commit 246ab3d379475641e8e6a485c02e5832a1af2416
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 0ea1ca2..14e311f 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1032,7 +1032,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 {
@@ -2621,7 +2621,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") {
@@ -2637,7 +2637,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") {
@@ -2711,10 +2711,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]