]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
valadoc: Add implicit "Posix" using-directive for POSIX profile
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 7 May 2020 08:44:54 +0000 (10:44 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 7 May 2020 08:44:54 +0000 (10:44 +0200)
valadoc/treebuilder.vala

index 82e8a9287d47d22e6c9d0b4e815446aec402fa7f..67e1d460ed98d66ee8b7f6ba1aca60c718df032f 100644 (file)
@@ -435,7 +435,12 @@ public class Valadoc.TreeBuilder : Vala.CodeVisitor {
 
                                        register_source_file (source_package, source_file);
 
-                                       if (context.profile == Vala.Profile.GOBJECT) {
+                                       if (context.profile == Vala.Profile.POSIX) {
+                                               // import the Posix namespace by default (namespace of backend-specific standard library)
+                                               var ns_ref = new Vala.UsingDirective (new Vala.UnresolvedSymbol (null, "Posix", null));
+                                               source_file.add_using_directive (ns_ref);
+                                               context.root.add_using_directive (ns_ref);
+                                       } else if (context.profile == Vala.Profile.GOBJECT) {
                                                // import the GLib namespace by default (namespace of backend-specific standard library)
                                                var ns_ref = new Vala.UsingDirective (new Vala.UnresolvedSymbol (null, "GLib", null));
                                                source_file.add_using_directive (ns_ref);