From 3a18e2e2d0c09fc1840fd8601fcc3d23be2f2a33 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Thu, 7 Jul 2011 12:02:57 +0200 Subject: [PATCH] On-demand Struct.decimal_floating_type --- vala/valastruct.vala | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/vala/valastruct.vala b/vala/valastruct.vala index f6266ea09..40b201620 100644 --- a/vala/valastruct.vala +++ b/vala/valastruct.vala @@ -41,7 +41,7 @@ public class Vala.Struct : TypeSymbol { private bool? boolean_type; private bool? integer_type; private bool? floating_type; - private bool decimal_floating_type; + private bool? decimal_floating_type; private bool? simple_type; private int? rank; private int? _width; @@ -418,11 +418,12 @@ public class Vala.Struct : TypeSymbol { } public bool is_decimal_floating_type () { - if (base_type != null) { - var st = base_struct; - if (st != null && st.is_decimal_floating_type ()) { - return true; - } + var st = base_struct; + if (st != null && st.is_decimal_floating_type ()) { + return true; + } + if (decimal_floating_type == null) { + decimal_floating_type = get_attribute_bool ("FloatingType", "decimal"); } return decimal_floating_type; } @@ -511,12 +512,6 @@ public class Vala.Struct : TypeSymbol { } } - private void process_floating_type_attribute (Attribute a) { - if (a.has_argument ("decimal")) { - decimal_floating_type = a.get_bool ("decimal"); - } - } - /** * Process all associated attributes. */ @@ -524,8 +519,6 @@ public class Vala.Struct : TypeSymbol { foreach (Attribute a in attributes) { if (a.name == "CCode") { process_ccode_attribute (a); - } else if (a.name == "FloatingType") { - process_floating_type_attribute (a); } else if (a.name == "Immutable") { is_immutable = true; } else if (a.name == "Deprecated") { -- 2.47.2