[vala/0.50] valadoc: Don't call CodeContext.pop() on empty stack
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.50] valadoc: Don't call CodeContext.pop() on empty stack
- Date: Mon, 26 Oct 2020 08:10:14 +0000 (UTC)
commit 30af3ddf1f5c4e0c9e1708c90043587bef3f1ff8
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Oct 25 17:50:26 2020 +0100
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
valadoc/valadoc.vala | 26 +++++++++++++++-----------
1 file 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) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]