[vala/wip/attributes-clean: 15/21] On-demand Struct.is_immutable
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/attributes-clean: 15/21] On-demand Struct.is_immutable
- Date: Thu, 7 Jul 2011 13:58:06 +0000 (UTC)
commit 18f295b08674e9c176b2864e8ac452a5f83aaa24
Author: Luca Bruno <lucabru src gnome org>
Date: Thu Jul 7 12:05:37 2011 +0200
On-demand Struct.is_immutable
vala/valastruct.vala | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/vala/valastruct.vala b/vala/valastruct.vala
index 2b14bd8..072e8dc 100644
--- a/vala/valastruct.vala
+++ b/vala/valastruct.vala
@@ -46,6 +46,7 @@ public class Vala.Struct : TypeSymbol {
private int? rank;
private int? width;
private bool? signed;
+ private bool? _is_immutable;
private string marshaller_type_name;
private string get_value_function;
private string set_value_function;
@@ -88,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.
@@ -518,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]