[vala/wip/attributes: 5/31] On-demand Class.is_compact



commit 6e7f9ce60be31f5ebf23022806a86b7d5d25abd4
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Jul 7 11:38:21 2011 +0200

    On-demand Class.is_compact

 vala/valaclass.vala |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index 6c1cc6e..f595248 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -47,10 +47,14 @@ public class Vala.Class : ObjectTypeSymbol {
 			if (base_class != null) {
 				return base_class.is_compact;
 			}
+			if (_is_compact == null) {
+				_is_compact = get_attribute ("Compact") != null;
+			}
 			return _is_compact;
 		}
 		set {
 			_is_compact = value;
+			set_attribute ("Compact", value);
 		}
 	}
 
@@ -126,7 +130,7 @@ public class Vala.Class : ObjectTypeSymbol {
 	private string get_value_function;
 	private string set_value_function;
 	private string take_value_function;
-	private bool _is_compact;
+	private bool? _is_compact;
 	private bool _is_immutable;
 
 	private List<DataType> base_types = new ArrayList<DataType> ();
@@ -745,8 +749,6 @@ public class Vala.Class : ObjectTypeSymbol {
 		foreach (Attribute a in attributes) {
 			if (a.name == "CCode") {
 				process_ccode_attribute (a);
-			} else if (a.name == "Compact") {
-				is_compact = true;
 			} 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]