From 93297a48cb7413ff6ca3ee189981e96475208290 Mon Sep 17 00:00:00 2001 From: Juerg Billeter Date: Sun, 23 Mar 2008 19:34:45 +0000 Subject: [PATCH] inherit default value from base type 2008-03-23 Juerg Billeter * vala/valastruct.vala: inherit default value from base type svn path=/trunk/; revision=1157 --- ChangeLog | 4 ++++ vala/valastruct.vala | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8a4d52d..941f79c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2008-03-23 Jürg Billeter + * vala/valastruct.vala: inherit default value from base type + +2008-03-23 Jürg Billeter + * vala/valareport.vala, vala/valasourcefile.vala, compiler/valacompiler.vala: add -v commandline option to improve error reporting, patch by Daniel Silverstone, fixes bug 522511 diff --git a/vala/valastruct.vala b/vala/valastruct.vala index ca5dd4e..c5643a7 100644 --- a/vala/valastruct.vala +++ b/vala/valastruct.vala @@ -378,7 +378,18 @@ public class Vala.Struct : Typesymbol { } public override string get_default_value () { - return default_value; + if (default_value != null) { + return default_value; + } + + // inherit default value from base type + foreach (DataType type in base_types) { + var st = type.data_type as Struct; + if (st != null) { + return st.get_default_value (); + } + } + return null; } private void set_default_value (string! value) { -- 2.7.4