[vala/staging: 6/12] 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/staging: 6/12] girparser: Accept setters with boolean return-type as valid property-accessor
- Date: Fri, 8 Dec 2017 23:38:32 +0000 (UTC)
commit 445c53c570c9e11a731023d3a605a184f1a5b0c1
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 a63b90d..1715ad1 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 {
@@ -2614,7 +2614,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") {
@@ -2630,7 +2630,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") {
@@ -2704,10 +2704,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]