[vala/wip/attributes-clean: 15/32] On-demand Struct.is_immutable
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/attributes-clean: 15/32] On-demand Struct.is_immutable
- Date: Sat, 9 Jul 2011 12:55:01 +0000 (UTC)
commit 4c694e20f35a38fa28741b70831343062acaa1dd
Author: Luca Bruno <lucabru src gnome org>
Date: Thu Jul 7 12:05:37 2011 +0200
On-demand Struct.is_immutable
vala/valastruct.vala | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/vala/valastruct.vala b/vala/valastruct.vala
index 40b2016..ea0ccf7 100644
--- a/vala/valastruct.vala
+++ b/vala/valastruct.vala
@@ -89,7 +89,18 @@ public class Vala.Struct : TypeSymbol {
* Specifies if 'const' should be emitted for input parameters
* of this type.
*/
- public bool is_immutable { get; set; }
+ public bool is_immutable {
+ get {
+ if (_is_immutable == null) {
+ _is_immutable = get_attribute ("Immutable") != null;
+ }
+ return _is_immutable;
+ }
+ set {
+ _is_immutable = value;
+ set_attribute ("Immutable", value);
+ }
+ }
/**
* Specifies whether this struct has a registered GType.
@@ -519,8 +530,6 @@ public class Vala.Struct : TypeSymbol {
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]