2008-03-23 Juerg Billeter <j@bitron.ch>
* vala/valastruct.vala: inherit default value from base type
svn path=/trunk/; revision=1157
2008-03-23 Jürg Billeter <j@bitron.ch>
+ * vala/valastruct.vala: inherit default value from base type
+
+2008-03-23 Jürg Billeter <j@bitron.ch>
+
* vala/valareport.vala, vala/valasourcefile.vala,
compiler/valacompiler.vala: add -v commandline option to improve
error reporting, patch by Daniel Silverstone, fixes bug 522511
}
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) {