diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-01-31 14:21:19 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-02-27 19:48:31 +0100 |
commit | 50f5ffc9c6a7c2378729dec0dc5027d73d1b411b (patch) | |
tree | 5c3e42bb6acd7f8a9674041fbc1c62ca6ba6520b /vala | |
parent | 8d6d79affee6cb7b28427b6c8e03b466ddc69626 (diff) | |
download | vala-50f5ffc9c6a7c2378729dec0dc5027d73d1b411b.tar.gz |
girparser: Set CCode.type_cname for classes if it doesn't match our default
Diffstat (limited to 'vala')
-rw-r--r-- | vala/valagirparser.vala | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala index 05ef1f942..c33e64aad 100644 --- a/vala/valagirparser.vala +++ b/vala/valagirparser.vala @@ -1215,10 +1215,13 @@ public class Vala.GirParser : CodeVisitor { // record for a gtype var gtype_struct_for = girdata["glib:is-gtype-struct-for"]; if (gtype_struct_for != null) { - var iface = parser.resolve_node (parent, parser.parse_symbol_from_string (gtype_struct_for, source_reference)); - if (iface != null && iface.symbol is Interface && "%sIface".printf (iface.get_cname ()) != get_cname ()) { + var obj = parser.resolve_node (parent, parser.parse_symbol_from_string (gtype_struct_for, source_reference)); + if (obj != null && obj.symbol is Interface && "%sIface".printf (obj.get_cname ()) != get_cname ()) { // set the interface struct name - iface.symbol.set_attribute_string ("CCode", "type_cname", get_cname ()); + obj.symbol.set_attribute_string ("CCode", "type_cname", get_cname ()); + } else if (obj != null && obj.symbol is Class && "%sClass".printf (obj.get_cname ()) != get_cname ()) { + // set the class struct name + obj.symbol.set_attribute_string ("CCode", "type_cname", get_cname ()); } merged = true; } |