[vala/wip/attributes-clean: 13/21] On-demand Struct.signed
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/attributes-clean: 13/21] On-demand Struct.signed
- Date: Thu, 7 Jul 2011 13:57:56 +0000 (UTC)
commit 2a875599ca00cb0612c442f5eaf898e38ae7f5ff
Author: Luca Bruno <lucabru src gnome org>
Date: Thu Jul 7 12:01:43 2011 +0200
On-demand Struct.signed
vala/valastruct.vala | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/vala/valastruct.vala b/vala/valastruct.vala
index 9447971..09f7d64 100644
--- a/vala/valastruct.vala
+++ b/vala/valastruct.vala
@@ -45,6 +45,7 @@ public class Vala.Struct : TypeSymbol {
private bool? simple_type;
private int? rank;
private int? width;
+ private bool? signed;
private string marshaller_type_name;
private string get_value_function;
private string set_value_function;
@@ -115,7 +116,18 @@ public class Vala.Struct : TypeSymbol {
}
}
- public bool signed { get; set; default = true; }
+ public bool signed {
+ get {
+ if (_signed == null) {
+ _signed = get_attribute_bool ("IntegerType", "signed", true);
+ }
+ return _signed;
+ }
+ set {
+ _signed = value;
+ set_attribute_bool ("IntegerType", "signed", value);
+ }
+ }
public bool has_copy_function { get; set; default = true; }
@@ -498,12 +510,6 @@ public class Vala.Struct : TypeSymbol {
}
}
- private void process_integer_type_attribute (Attribute a) {
- if (a.has_argument ("signed")) {
- signed = a.get_bool ("signed");
- }
- }
-
private void process_floating_type_attribute (Attribute a) {
if (a.has_argument ("decimal")) {
decimal_floating_type = a.get_bool ("decimal");
@@ -517,8 +523,6 @@ public class Vala.Struct : TypeSymbol {
foreach (Attribute a in attributes) {
if (a.name == "CCode") {
process_ccode_attribute (a);
- } else if (a.name == "IntegerType") {
- process_integer_type_attribute (a);
} else if (a.name == "FloatingType") {
process_floating_type_attribute (a);
} else if (a.name == "Immutable") {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]