From: Sergey Bugaev Date: Mon, 28 Apr 2025 07:31:16 +0000 (+0300) Subject: codegen: Propagate default_value_on_error from parent struct X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=b8f683d6a8ae9aa48351438646ff801bf1e773d2;p=thirdparty%2Fvala.git codegen: Propagate default_value_on_error from parent struct Like it's already done for default_value. This in particular should impact tests/structs/gtype-base-struct.vala when we set the default values for GLib.Type. --- diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala index 08de1251f..187409cca 100644 --- a/codegen/valaccodeattribute.vala +++ b/codegen/valaccodeattribute.vala @@ -426,7 +426,7 @@ public class Vala.CCodeAttribute : AttributeCache { _default_value_on_error = ccode.get_string ("default_value_on_error"); } if (_default_value_on_error == null) { - _default_value_on_error = default_value; + _default_value_on_error = get_default_default_value_on_error (); } } return _default_value_on_error; @@ -1470,6 +1470,16 @@ public class Vala.CCodeAttribute : AttributeCache { return ""; } + private string get_default_default_value_on_error () { + if (sym is Struct) { + unowned Struct? base_st = ((Struct) sym).base_struct; + if (base_st != null) { + return get_ccode_default_value_on_error (base_st); + } + } + return default_value; + } + private string get_finish_name_for_basename (string basename) { string result = basename; if (result.has_suffix ("_async")) {