[vala/wip/attributes: 20/39] On-demand Struct.is_immutable
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/attributes: 20/39] On-demand Struct.is_immutable
- Date: Mon, 1 Aug 2011 16:39:35 +0000 (UTC)
commit 34a66ad2dfc4006052dad3f0d452b21045c5ed6f
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]