[vala/0.14] girparser: Only reparent static methods within the same GIR
- From: JÃrg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.14] girparser: Only reparent static methods within the same GIR
- Date: Tue, 31 Jan 2012 13:14:37 +0000 (UTC)
commit 8e38d884f76c715e147b9c7b25652ee9346b062c
Author: Luca Bruno <lucabru src gnome org>
Date: Thu Jan 5 19:27:04 2012 +0100
girparser: Only reparent static methods within the same GIR
vala/valagirparser.vala | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index eecb9d4..c6ced4b 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -3214,6 +3214,12 @@ public class Vala.GirParser : CodeVisitor {
}
}
+ bool same_gir (Symbol gir_component, Symbol sym) {
+ var gir_name = gir_component.source_reference.file.gir_namespace;
+ var gir_version = gir_component.source_reference.file.gir_version;
+ return "%s-%s".printf (gir_name, gir_version) in sym.source_reference.file.filename;
+ }
+
void process_namespace_method (Node ns, Node node) {
/* transform static methods into instance methods if possible.
In most of cases this is a .gir fault we are going to fix */
@@ -3230,7 +3236,7 @@ public class Vala.GirParser : CodeVisitor {
// check if it's a missed instance method (often happens for structs)
var sym = ((UnresolvedType) first_param.variable_type).unresolved_symbol;
var parent = resolve_node (ns, sym);
- if (parent != null && parent.parent == ns && is_container (parent.symbol) && cname.has_prefix (parent.get_lower_case_cprefix ())) {
+ if (parent != null && same_gir (method, parent.symbol) && parent.parent == ns && is_container (parent.symbol) && cname.has_prefix (parent.get_lower_case_cprefix ())) {
// instance method
var new_name = method.name.substring (parent.get_lower_case_cprefix().length - ns_cprefix.length);
if (parent.lookup (new_name) == null) {
@@ -3249,7 +3255,7 @@ public class Vala.GirParser : CodeVisitor {
Node parent = ns;
find_parent (cname, ns, ref parent, ref match);
var new_name = method.name.substring (parent.get_lower_case_cprefix().length - ns_cprefix.length);
- if (parent.lookup (new_name) == null) {
+ if (same_gir (method, parent.symbol) && parent.lookup (new_name) == null) {
ns.remove_member (node);
node.name = new_name;
method.name = new_name;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]