[vala/0.40] valadoc: Create and register current Vala.CodeContext properly



commit ce93c4f380d700238675a2d33cbc0b3df187250c
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Fri Mar 13 19:30:32 2020 +0100

    valadoc: Create and register current Vala.CodeContext properly

 valadoc/tests/drivers/generic-api-test.vala | 4 ++++
 valadoc/treebuilder.vala                    | 6 +-----
 valadoc/valadoc.vala                        | 4 ++++
 3 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/valadoc/tests/drivers/generic-api-test.vala b/valadoc/tests/drivers/generic-api-test.vala
index a5cb74887..4ec0b1243 100644
--- a/valadoc/tests/drivers/generic-api-test.vala
+++ b/valadoc/tests/drivers/generic-api-test.vala
@@ -2921,6 +2921,8 @@ public static void test_driver () {
        settings.pkg_name = "out";
        settings.path = "out";
 
+       var context = new Vala.CodeContext ();
+       Vala.CodeContext.push (context);
 
        var driver = new Valadoc.Drivers.Driver ();
        assert (driver != null);
@@ -2967,6 +2969,8 @@ public static void test_driver () {
        assert (glib == true);
        assert (gobj == true);
        assert (test == true);
+
+       Vala.CodeContext.pop ();
 }
 
 
diff --git a/valadoc/treebuilder.vala b/valadoc/treebuilder.vala
index 955b703d7..a5c79f9db 100644
--- a/valadoc/treebuilder.vala
+++ b/valadoc/treebuilder.vala
@@ -821,9 +821,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 
        private Vala.CodeContext create_valac_tree (Settings settings) {
                // init context:
-               var context = new Vala.CodeContext ();
-               Vala.CodeContext.push (context);
-
+               var context = Vala.CodeContext.get ();
 
                // settings:
                context.experimental = settings.experimental;
@@ -1485,8 +1483,6 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
 
                context.accept(this);
 
-               Vala.CodeContext.pop ();
-
                return (reporter.errors == 0)? tree : null;
        }
 }
diff --git a/valadoc/valadoc.vala b/valadoc/valadoc.vala
index 7fb970976..05a667108 100644
--- a/valadoc/valadoc.vala
+++ b/valadoc/valadoc.vala
@@ -129,9 +129,11 @@ public class ValaDoc : Object {
        private static int quit (ErrorReporter reporter) {
                if (reporter.errors == 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;
                }
        }
@@ -229,6 +231,8 @@ public class ValaDoc : Object {
 
                settings.alternative_resource_dirs = alternative_resource_dirs;
 
+               var context = new Vala.CodeContext ();
+               Vala.CodeContext.push (context);
 
                var driver = new Valadoc.Drivers.Driver ();
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]