From: Rico Tzschichholz Date: Mon, 27 Jul 2020 16:10:38 +0000 (+0200) Subject: girwriter: Don't include symbols outside of a namespace X-Git-Tag: 0.46.12~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40ebf5371bc0c9a89284899df5f670e00b75127b;p=thirdparty%2Fvala.git girwriter: Don't include symbols outside of a namespace Additionally report a warning for symbols which doesn't fulfill this rule. Fixes https://gitlab.gnome.org/GNOME/vala/issues/241 --- diff --git a/codegen/valaccodearraymodule.vala b/codegen/valaccodearraymodule.vala index 7a9386219..f89433ce1 100644 --- a/codegen/valaccodearraymodule.vala +++ b/codegen/valaccodearraymodule.vala @@ -497,7 +497,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule { unowned ArrayType? array_type = value.value_type as ArrayType; if (array_type != null && array_type.fixed_length) { - unowned Struct? st = array_type.element_type.type_symbol as Struct; + unowned Struct? st = array_type.element_type.data_type as Struct; if (st != null && !array_type.element_type.nullable) { var ccall = new CCodeFunctionCall (new CCodeIdentifier (append_struct_array_destroy (st))); ccall.add_argument (get_cvalue_ (value)); diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala index 0cf6f6bb5..9c98be05d 100644 --- a/codegen/valagirwriter.vala +++ b/codegen/valagirwriter.vala @@ -392,6 +392,10 @@ public class Vala.GIRWriter : CodeVisitor { return; } + if (!has_namespace (cl)) { + return; + } + if (!(hierarchy[0] is Namespace)) { deferred.add (cl); return; @@ -591,6 +595,10 @@ public class Vala.GIRWriter : CodeVisitor { return; } + if (!has_namespace (st)) { + return; + } + if (!(hierarchy[0] is Namespace)) { deferred.add (st); return; @@ -629,6 +637,10 @@ public class Vala.GIRWriter : CodeVisitor { return; } + if (!has_namespace (iface)) { + return; + } + if (!(hierarchy[0] is Namespace)) { deferred.add (iface); return; @@ -794,6 +806,10 @@ public class Vala.GIRWriter : CodeVisitor { return; } + if (!has_namespace (en)) { + return; + } + if (!(hierarchy[0] is Namespace)) { deferred.add (en); return; @@ -868,6 +884,10 @@ public class Vala.GIRWriter : CodeVisitor { return; } + if (!has_namespace (edomain)) { + return; + } + write_indent (); buffer.append_printf ("