[vala/staging] girparser: Improve instance method detection
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] girparser: Improve instance method detection
- Date: Tue, 9 Jan 2018 15:55:06 +0000 (UTC)
commit 1fdaa354a9b8c911dd84ce559f2337aa75c029e8
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Mon Jun 30 09:39:59 2014 +0200
girparser: Improve instance method detection
Improve reparenting static namespace functions to their presumably parent
structures. Only allow this if the first parameter is not defined as (out)
or (inout)
Unfortunately, while this patch fixes detection, nothing can be done about
breaking API.
Based on patch by Simon Werbeck <simon werbeck gmail com>
https://bugzilla.gnome.org/show_bug.cgi?id=732460
vala/valagirparser.vala | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index de5d772..7902e2d 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -3942,10 +3942,10 @@ public class Vala.GirParser : CodeVisitor {
var cname = node.get_cname ();
Parameter first_param = null;
- if (method.get_parameters ().size > 0) {
- first_param = method.get_parameters()[0];
+ if (node.parameters.size > 0) {
+ first_param = node.parameters[0].param;
}
- if (first_param != null && first_param.variable_type is UnresolvedType) {
+ if (first_param != null && first_param.direction == ParameterDirection.IN &&
first_param.variable_type is UnresolvedType) {
// 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);
@@ -3955,8 +3955,8 @@ public class Vala.GirParser : CodeVisitor {
if (parent.lookup (new_name) == null) {
ns.remove_member (node);
node.name = new_name;
+ node.parameters.remove_at (0);
method.name = new_name;
- method.get_parameters().remove_at (0);
method.binding = MemberBinding.INSTANCE;
parent.add_member (node);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]