[vala/wip/attributes-clean: 6/15] On-demand Class.is_immutable



commit 363eff2079eb3e41c7e5f6528432c4a0e88df8ef
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Jul 7 11:46:12 2011 +0200

    On-demand Class.is_immutable

 vala/valaclass.vala |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index 8300a3e..17c7081 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -66,10 +66,14 @@ public class Vala.Class : ObjectTypeSymbol {
 			if (base_class != null) {
 				return base_class.is_immutable;
 			}
+			if (_is_immutable == null) {
+				_is_immutable = get_attribute ("Immutable") != null;
+			}
 			return _is_immutable;
 		}
 		set {
 			_is_immutable = value;
+			set_attribute ("Immutable", value);
 		}
 	}
 
@@ -131,7 +135,7 @@ public class Vala.Class : ObjectTypeSymbol {
 	private string set_value_function;
 	private string take_value_function;
 	private bool? _is_compact;
-	private bool _is_immutable;
+	private bool? _is_immutable;
 
 	private List<DataType> base_types = new ArrayList<DataType> ();
 
@@ -747,8 +751,6 @@ public class Vala.Class : ObjectTypeSymbol {
 		foreach (Attribute a in attributes) {
 			if (a.name == "CCode") {
 				process_ccode_attribute (a);
-			} else if (a.name == "Immutable") {
-				is_immutable = true;
 			} else if (a.name == "Deprecated") {
 				process_deprecated_attribute (a);
 			} else if (a.name == "GIR") {



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