]> 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>
Mon, 18 May 2020 14:08:48 +0000 (16:08 +0200)
valadoc/treebuilder.vala

index ed89016d4e4911d72d32d9763921bc62b60baa02..bfd9ba93a6d4da71fb6016dc27a4eed3c75cb2c7 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);