[vala/wip/attributes: 16/32] On-demand Symbol.deprecated



commit 2118b01c4692438ea01946e9385f766e7cb57be1
Author: Luca Bruno <lucabru src gnome org>
Date:   Thu Jul 7 15:44:10 2011 +0200

    On-demand Symbol.deprecated

 vala/valasymbol.vala |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala
index 5b1ef12..c19819a 100644
--- a/vala/valasymbol.vala
+++ b/vala/valasymbol.vala
@@ -82,7 +82,18 @@ public abstract class Vala.Symbol : CodeNode {
 	/**
 	 * Specifies whether this symbol has been deprecated.
 	 */
-	public bool deprecated { get; set; default = false; }
+	public bool deprecated {
+		get {
+			if (_deprecated == null) {
+				_deprecated = get_attribute ("Deprecated") != null;
+			}
+			return _deprecated;
+		}
+		set {
+			_deprecated = value;
+			set_attribute ("Deprecated", _deprecated);
+		}
+	}
 
 	/**
 	 * Specifies what version this symbol has been deprecated since.
@@ -194,6 +205,7 @@ public abstract class Vala.Symbol : CodeNode {
 	private weak Scope _owner;
 	private Scope _scope;
 	private string? _gir_name = null;
+	private bool? _deprecated;
 
 	public Symbol (string? name, SourceReference? source_reference, Comment? comment = null) {
 		this.name = name;
@@ -481,8 +493,6 @@ public abstract class Vala.Symbol : CodeNode {
 			return;
 		}
 
-		deprecated = true;
-
 		if (attr.has_argument ("since")) {
 			deprecated_since = attr.get_string ("since");
 		}



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