[vala] girparser: Assume methods with the same name of a property are getters



commit 95a5b21214721315a89efcb4fd4dd217d1ab5260
Author: Luca Bruno <lucabru src gnome org>
Date:   Sat Apr 23 10:58:44 2011 +0200

    girparser: Assume methods with the same name of a property are getters

 vala/valagirparser.vala |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 8090b17..4c1680c 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -876,6 +876,8 @@ public class Vala.GirParser : CodeVisitor {
 			}
 		} else if (info.symbol is Property) {
 			var prop = (Property) info.symbol;
+			var getter_name = "get_%s".printf (prop.name);
+			var setter_name = "set_%s".printf (prop.name);
 			foreach (var cinfo in colliding) {
 				var sym = cinfo.symbol;
 				if (sym is Signal || sym is Field) {
@@ -884,10 +886,9 @@ public class Vala.GirParser : CodeVisitor {
 				} else if (sym is Method) {
 					// assume method is getter
 					merged.add (cinfo);
+					getter_name = sym.name;
 				}
 			}
-			var getter_name = "get_%s".printf (prop.name);
-			var setter_name = "set_%s".printf (prop.name);
 			if (prop.get_accessor != null) {
 				var getter_method = get_current_first_symbol (getter_name) as Method;
 				if (getter_method != null) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]