[vala/wip/attributes: 105/119] Drop process_attributes in method



commit e538537b4a590febfa4f4f3971455abfbc2fc1f4
Author: Luca Bruno <lucabru src gnome org>
Date:   Sun Jul 3 12:58:36 2011 +0200

    Drop process_attributes in method

 vala/valamethod.vala |   37 +++++++++++++++++++------------------
 1 files changed, 19 insertions(+), 18 deletions(-)
---
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index 38466c4..f275f7c 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -113,12 +113,26 @@ public class Vala.Method : Subroutine {
 	/**
 	 * Specifies whether this method expects printf-style format arguments.
 	 */
-	public bool printf_format { get; set; }
+	public bool printf_format {
+		get {
+			if (_printf_format == null) {
+				_printf_format = get_attribute ("PrintfFormat");
+			}
+			return _printf_format;
+		}
+	}
 
 	/**
 	 * Specifies whether this method expects scanf-style format arguments.
 	 */
-	public bool scanf_format { get; set; }
+	public bool scanf_format {
+		get {
+			if (_scanf_format == null) {
+				_scanf_format = get_attribute ("ScanfFormat");
+			}
+			return _scanf_format;
+		}
+	}
 
 	/**
 	 * Specifies whether a construct function with a GType parameter is
@@ -247,21 +261,6 @@ public class Vala.Method : Subroutine {
 	}
 
 	/**
-	 * Process all associated attributes.
-	 */
-	public void process_attributes () {
-		foreach (Attribute a in attributes) {
-			if (a.name == "PrintfFormat") {
-				printf_format = true;
-			} else if (a.name == "ScanfFormat") {
-				scanf_format = true;
-			} else if (a.name == "DestroysInstance") {
-				this_parameter.variable_type.value_owned = true;
-			}
-		}
-	}
-
-	/**
 	 * Checks whether the parameters and return type of this method are
 	 * compatible with the specified method
 	 *
@@ -544,7 +543,9 @@ public class Vala.Method : Subroutine {
 
 		checked = true;
 
-		process_attributes ();
+		if (get_attribute ("DestroysInstance") != null) {
+			this_parameter.variable_type.value_owned = true;
+		}
 
 		if (is_abstract) {
 			if (parent_symbol is Class) {



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