[vala/wip/attributes: 43/121] Make Delegate.has_target be loaded on-demand



commit 6a3022c763fa8380fbeccd297ba36b99759a204d
Author: Luca Bruno <lucabru src gnome org>
Date:   Wed Jun 29 11:53:50 2011 +0200

    Make Delegate.has_target be loaded on-demand

 vala/valadelegate.vala |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/vala/valadelegate.vala b/vala/valadelegate.vala
index 9a4ed75..e1aa8bd 100644
--- a/vala/valadelegate.vala
+++ b/vala/valadelegate.vala
@@ -42,7 +42,18 @@ public class Vala.Delegate : TypeSymbol {
 	 * The reference to the object instance will be appended to the end of
 	 * the argument list in the generated C code.
 	 */
-	public bool has_target { get; set; }
+	public bool has_target {
+		get {
+			if (_has_target == null) {
+				_has_target = get_attribute_bool ("CCode", "has_target");
+			}
+			return _has_target;
+		}
+		set {
+			_has_target = value;
+			set_attribute_bool ("CCode", "has_target", value);
+		}
+	}
 
 	public DataType? sender_type { get; set; }
 
@@ -80,6 +91,7 @@ public class Vala.Delegate : TypeSymbol {
 	private string cname;
 
 	private DataType _return_type;
+	private bool? _has_target;
 
 	/**
 	 * Creates a new delegate.
@@ -277,9 +289,6 @@ public class Vala.Delegate : TypeSymbol {
 		if (a.has_argument ("cname")) {
 			set_cname (a.get_string ("cname"));
 		}
-		if (a.has_argument ("has_target")) {
-			has_target = a.get_bool ("has_target");
-		}
 		if (a.has_argument ("array_length")) {
 			no_array_length = !a.get_bool ("array_length");
 		}



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