[vala/wip/attributes-clean: 14/15] On-demand Struct.decimal_floating_type



commit 3d419c2827b82c0128c46f2419e0708ebe1929cd
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Jul 7 12:02:57 2011 +0200

    On-demand Struct.decimal_floating_type

 vala/valastruct.vala |   21 +++++++--------------
 1 files changed, 7 insertions(+), 14 deletions(-)
---
diff --git a/vala/valastruct.vala b/vala/valastruct.vala
index 09f7d64..2b14bd8 100644
--- a/vala/valastruct.vala
+++ b/vala/valastruct.vala
@@ -41,7 +41,7 @@ public class Vala.Struct : TypeSymbol {
 	private bool? boolean_type;
 	private bool? integer_type;
 	private bool? floating_type;
-	private bool decimal_floating_type;
+	private bool? decimal_floating_type;
 	private bool? simple_type;
 	private int? rank;
 	private int? width;
@@ -417,11 +417,12 @@ public class Vala.Struct : TypeSymbol {
 	}
 
 	public bool is_decimal_floating_type () {
-		if (base_type != null) {
-			var st = base_struct;
-			if (st != null && st.is_decimal_floating_type ()) {
-				return true;
-			}
+		var st = base_struct;
+		if (st != null && st.is_decimal_floating_type ()) {
+			return true;
+		}
+		if (decimal_floating_type == null) {
+			decimal_floating_type = get_attribute ("FloatingType", "decimal");
 		}
 		return decimal_floating_type;
 	}
@@ -510,12 +511,6 @@ public class Vala.Struct : TypeSymbol {
 		}
 	}
 
-	private void process_floating_type_attribute (Attribute a) {
-		if (a.has_argument ("decimal")) {
-			decimal_floating_type = a.get_bool ("decimal");
-		}
-	}
-	
 	/**
 	 * Process all associated attributes.
 	 */
@@ -523,8 +518,6 @@ public class Vala.Struct : TypeSymbol {
 		foreach (Attribute a in attributes) {
 			if (a.name == "CCode") {
 				process_ccode_attribute (a);
-			} else if (a.name == "FloatingType") {
-				process_floating_type_attribute (a);
 			} else if (a.name == "Immutable") {
 				is_immutable = true;
 			} else if (a.name == "Deprecated") {



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