[vala/switch-to-gir] girparser: Property without accessor must have owned get.



commit 42a92e30170fae3f891edce2bc3f1ae154d17093
Author: Luca Bruno <lucabru src gnome org>
Date:   Sat Nov 20 21:55:58 2010 +0100

    girparser: Property without accessor must have owned get.

 vala/valagirparser.vala |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 24dc899..104ab33 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -849,6 +849,7 @@ public class Vala.GirParser : CodeVisitor {
 				merged.add (info);
 			}
 		} else if (info.symbol is Property) {
+			var prop = (Property) info.symbol;
 			foreach (var cinfo in colliding) {
 				var sym = cinfo.symbol;
 				if (sym is Signal || sym is Field) {
@@ -859,10 +860,19 @@ public class Vala.GirParser : CodeVisitor {
 					merged.add (cinfo);
 				}
 			}
-			var getter_name = "get_%s".printf (info.symbol.name);
-			var setter_name = "set_%s".printf (info.symbol.name);
-			if (current_symbols_info.contains (getter_name) || current_symbols_info.contains (setter_name)) {
-				((Property) info.symbol).no_accessor_method = false;
+			var getter_name = "get_%s".printf (prop.name);
+			var setter_name = "set_%s".printf (prop.name);
+			if (prop.get_accessor != null && current_symbols_info.contains (getter_name)) {
+				var getter_list = current_symbols_info[getter_name];
+				foreach (var getter_info in getter_list) {
+					if (getter_info.symbol is Method) {
+						prop.no_accessor_method = false;
+						prop.get_accessor.value_type.value_owned = ((Method) getter_info.symbol).return_type.value_owned;
+						break;
+					}
+				}
+			} else if (prop.set_accessor != null && current_symbols_info.contains (setter_name)) {
+				prop.no_accessor_method = false;
 			}
 		} else if (info.symbol is Signal) {
 			var sig = (Signal) info.symbol;
@@ -2178,6 +2188,7 @@ public class Vala.GirParser : CodeVisitor {
 		prop.array_null_terminated = array_null_terminated;
 		if (readable != "0") {
 			prop.get_accessor = new PropertyAccessor (true, false, false, prop.property_type.copy (), null, null);
+			prop.get_accessor.value_type.value_owned = true;
 		}
 		if (writable == "1" || construct_only == "1") {
 			prop.set_accessor = new PropertyAccessor (false, (construct_only != "1") && (writable == "1"), (construct_only == "1") || (construct_ == "1"), prop.property_type.copy (), null, null);



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