summaryrefslogtreecommitdiff
path: root/valadoc
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2020-10-25 17:50:26 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2020-10-25 17:50:26 +0100
commiteebf2ad8ae3c3773739437acabac4966ed7effbf (patch)
treec81f75bf03229050fbfad8d8bb8ae6e19d919d40 /valadoc
parentb202924bd4981138e08eedc59269140192c7b21a (diff)
downloadvala-eebf2ad8ae3c3773739437acabac4966ed7effbf.tar.gz
valadoc: Don't call CodeContext.pop() on empty stack
Otherwise this results in an expected assertion. Fixes https://gitlab.gnome.org/GNOME/vala/issues/1064
Diffstat (limited to 'valadoc')
-rw-r--r--valadoc/valadoc.vala26
1 files changed, 15 insertions, 11 deletions
diff --git a/valadoc/valadoc.vala b/valadoc/valadoc.vala
index b9ae48c50..6ed4a6792 100644
--- a/valadoc/valadoc.vala
+++ b/valadoc/valadoc.vala
@@ -139,14 +139,18 @@ public class ValaDoc : Object {
return true;
}
- private static int quit (ErrorReporter reporter) {
+ private static int quit (ErrorReporter reporter, bool pop_context = false) {
if (reporter.errors == 0 && (!fatal_warnings || reporter.warnings == 0)) {
stdout.printf ("Succeeded - %d warning(s)\n", reporter.warnings);
- Vala.CodeContext.pop ();
+ if (pop_context) {
+ Vala.CodeContext.pop ();
+ }
return 0;
} else {
stdout.printf ("Failed: %d error(s), %d warning(s)\n", reporter.errors, reporter.warnings);
- Vala.CodeContext.pop ();
+ if (pop_context) {
+ Vala.CodeContext.pop ();
+ }
return 1;
}
}
@@ -251,7 +255,7 @@ public class ValaDoc : Object {
Doclet? doclet = null;
ModuleLoader? modules = create_module_loader (reporter, out doclet);
if (reporter.errors > 0 || modules == null) {
- return quit (reporter);
+ return quit (reporter, true);
}
// Create tree:
@@ -259,7 +263,7 @@ public class ValaDoc : Object {
Valadoc.Api.Tree doctree = builder.build (settings, reporter);
if (reporter.errors > 0) {
doclet = null;
- return quit (reporter);
+ return quit (reporter, true);
}
SymbolResolver resolver = new SymbolResolver (builder);
doctree.accept (resolver);
@@ -271,7 +275,7 @@ public class ValaDoc : Object {
// process documentation
Valadoc.DocumentationParser docparser = new Valadoc.DocumentationParser (settings, reporter, doctree, modules);
if (!doctree.create_tree()) {
- return quit (reporter);
+ return quit (reporter, true);
}
DocumentationImporter[] importers = {
@@ -281,17 +285,17 @@ public class ValaDoc : Object {
doctree.parse_comments (docparser);
if (reporter.errors > 0) {
- return quit (reporter);
+ return quit (reporter, true);
}
doctree.import_comments (importers, import_packages, import_directories);
if (reporter.errors > 0) {
- return quit (reporter);
+ return quit (reporter, true);
}
doctree.check_comments (docparser);
if (reporter.errors > 0) {
- return quit (reporter);
+ return quit (reporter, true);
}
if (ValaDoc.gir_name != null) {
@@ -303,12 +307,12 @@ public class ValaDoc : Object {
settings.gir_version,
settings.pkg_name);
if (reporter.errors > 0) {
- return quit (reporter);
+ return quit (reporter, true);
}
}
doclet.process (settings, doctree, reporter);
- return quit (reporter);
+ return quit (reporter, true);
}
static int main (string[] args) {