]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
valadoc: Create and register current Vala.CodeContext properly ccf932f616dc60b856a37f28924b35e52d3d4e83
authorRico Tzschichholz <ricotz@ubuntu.com>
Fri, 13 Mar 2020 18:30:32 +0000 (19:30 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Fri, 13 Mar 2020 18:30:32 +0000 (19:30 +0100)
valadoc/tests/drivers/generic-api-test.vala
valadoc/treebuilder.vala
valadoc/valadoc.vala

index ced2bb6e669d5ac6fbe43c3dea6682726dfce4ef..79aa31d11cf402cee32b953601ce7958be5b928f 100644 (file)
@@ -2900,6 +2900,8 @@ public static void test_driver () {
        settings.pkg_name = "out";
        settings.path = "out";
 
+       var context = new Vala.CodeContext ();
+       Vala.CodeContext.push (context);
 
        TreeBuilder builder = new TreeBuilder ();
        Api.Tree? doctree = builder.build (settings, reporter);
@@ -2945,6 +2947,8 @@ public static void test_driver () {
        assert (glib == true);
        assert (gobj == true);
        assert (test == true);
+
+       Vala.CodeContext.pop ();
 }
 
 
index e2175ac4ab08b89d9353dd9266ea51ab7a160809..433938af2d3b495fc59c4e25cde1b8570e9f10ec 100644 (file)
@@ -984,8 +984,7 @@ public class Valadoc.TreeBuilder : Vala.CodeVisitor {
                this.settings = settings;
                this.reporter = reporter;
 
-               var context = new Vala.CodeContext ();
-               Vala.CodeContext.push (context);
+               var context = Vala.CodeContext.get ();
 
                this.tree = new Api.Tree (reporter, settings, context);
                create_valac_tree (context, settings);
@@ -1007,8 +1006,6 @@ public class Valadoc.TreeBuilder : Vala.CodeVisitor {
 
                context.accept(this);
 
-               Vala.CodeContext.pop ();
-
                return (reporter.errors == 0)? tree : null;
        }
 }
index 2bb6558f942a74bbf97fa5571c1f23d2a1bdb7d4..87695b1e69cb0c9a3ec0a3dc6878317007e4f00e 100644 (file)
@@ -131,9 +131,11 @@ public class ValaDoc : Object {
        private static int quit (ErrorReporter reporter) {
                if (reporter.errors == 0 && (!fatal_warnings || reporter.warnings == 0)) {
                        stdout.printf ("Succeeded - %d warning(s)\n", reporter.warnings);
+                       Vala.CodeContext.pop ();
                        return 0;
                } else {
                        stdout.printf ("Failed: %d error(s), %d warning(s)\n", reporter.errors, reporter.warnings);
+                       Vala.CodeContext.pop ();
                        return 1;
                }
        }
@@ -231,6 +233,8 @@ public class ValaDoc : Object {
 
                settings.alternative_resource_dirs = alternative_resource_dirs;
 
+               var context = new Vala.CodeContext ();
+               Vala.CodeContext.push (context);
 
                // load plugins:
                Doclet? doclet = null;