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



commit 5a4eaa70cbc00f233cb535ee4d66b1fa1e3cc241
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 92ca064..8300a3e 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> ();
@@ -743,8 +747,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]