[vala/switch-to-gir] girparser: Guess NoAccessorMethod attribute for properties
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/switch-to-gir] girparser: Guess NoAccessorMethod attribute for properties
- Date: Fri, 27 Aug 2010 15:03:57 +0000 (UTC)
commit c4fbaa5497aea50532c0ecc19af51fadfe0ab6a9
Author: Luca Bruno <lethalman88 gmail com>
Date: Fri Aug 27 17:03:32 2010 +0200
girparser: Guess NoAccessorMethod attribute for properties
vala/valagirparser.vala | 34 +++++++++++++++++++++++-----------
1 files changed, 23 insertions(+), 11 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index de2e54c..cd8bbf5 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -875,28 +875,39 @@ public class Vala.GirParser : CodeVisitor {
}
bool merge (Symbol container, SymbolInfo info, ArrayList<SymbolInfo> colliding) {
- bool merged = false;
-
if (info.symbol is Signal) {
foreach (var cinfo in colliding) {
var sym = cinfo.symbol;
if (sym is Property) {
// properties take precedence
- merged = true;
+ return true;
}
}
- } else if (info.symbol is Method) {
+ } else if (info.symbol is Method && !(info.symbol is CreationMethod)) {
var method = (Method) info.symbol;
+ if (method.name.has_prefix ("get_")) {
+ var symbols = current_symbols_info[method.name.offset ("get_".length)];
+ if (symbols != null) {
+ foreach (var cinfo in symbols) {
+ var sym = cinfo.symbol;
+ if (sym is Property) {
+ // assume getter for property
+ ((Property) sym).no_accessor_method = false;
+ return true;
+ }
+ }
+ }
+ }
if (method.is_virtual) {
// virtual-method
foreach (var cinfo in colliding) {
var sym = cinfo.symbol;
if (sym is Signal) {
((Signal) sym).is_virtual = true;
- merged = true;
+ return true;
} else if (sym is Property || sym is Field) {
// assume method is getter for property/field ignore method
- merged = true;
+ return true;
}
}
} else {
@@ -905,24 +916,24 @@ public class Vala.GirParser : CodeVisitor {
var sym = cinfo.symbol;
if (sym is Signal) {
((Signal) sym).has_emitter = true;
- merged = true;
+ return true;
} else if (sym is Property || sym is Field) {
// assume method is getter for property/field ignore method
- merged = true;
+ return true;
} else if (sym is Method && ((Method) sym).is_virtual) {
// assume method is wrapper for virtual method
- merged = true;
+ return true;
}
}
}
} else if (info.symbol is Field) {
// fields have lowest priority
if (colliding.size > 1) {
- merged = true;
+ return true;
}
}
- return merged;
+ return false;
}
void merge_and_add (Symbol container) {
@@ -1767,6 +1778,7 @@ public class Vala.GirParser : CodeVisitor {
bool array_null_terminated;
var type = parse_type (null, null, false, out no_array_length, out array_null_terminated);
var prop = new Property (name, type, null, null, get_current_src ());
+ prop.no_accessor_method = true;
prop.no_array_length = no_array_length;
prop.array_null_terminated = array_null_terminated;
prop.access = SymbolAccessibility.PUBLIC;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]