[vala/staging] Add boolean CodeContext.keep_going and corresponding compiler option



commit 1430c461d4a45026331663989113feb195588255
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Sep 2 15:25:44 2019 +0200

    Add boolean CodeContext.keep_going and corresponding compiler option
    
    If keep_going is set then check() will continue after hitting errors in
    resolver and analyzer.

 compiler/valacompiler.vala | 3 +++
 doc/valac.1                | 3 +++
 vala/valacodecontext.vala  | 9 +++++++--
 3 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index d425202f1..c5105804a 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -75,6 +75,7 @@ class Vala.Compiler {
        static bool gobject_tracing;
        static bool disable_since_check;
        static bool disable_warnings;
+       static bool keep_going;
        static string cc_command;
        [CCode (array_length = false, array_null_terminated = true)]
        static string[] cc_options;
@@ -141,6 +142,7 @@ class Vala.Compiler {
                { "disable-warnings", 0, 0, OptionArg.NONE, ref disable_warnings, "Disable warnings", null },
                { "fatal-warnings", 0, 0, OptionArg.NONE, ref fatal_warnings, "Treat warnings as fatal", null 
},
                { "disable-since-check", 0, 0, OptionArg.NONE, ref disable_since_check, "Do not check whether 
used symbols exist in local packages", null },
+               { "keep-going", 'k', 0, OptionArg.NONE, ref keep_going, "Continue as much as possible after 
an error", null },
                { "enable-experimental-non-null", 0, 0, OptionArg.NONE, ref experimental_non_null, "Enable 
experimental enhancements for non-null types", null },
                { "enable-gobject-tracing", 0, 0, OptionArg.NONE, ref gobject_tracing, "Enable GObject 
creation tracing", null },
                { "cc", 0, 0, OptionArg.STRING, ref cc_command, "Use COMMAND as C compiler command", 
"COMMAND" },
@@ -233,6 +235,7 @@ class Vala.Compiler {
                context.experimental = experimental;
                context.experimental_non_null = experimental_non_null;
                context.gobject_tracing = gobject_tracing;
+               context.keep_going = keep_going;
                context.report.enable_warnings = !disable_warnings;
                context.report.set_verbose_errors (!quiet_mode);
                context.verbose_mode = verbose_mode;
diff --git a/doc/valac.1 b/doc/valac.1
index bf85d0e27..054ec6c9b 100644
--- a/doc/valac.1
+++ b/doc/valac.1
@@ -141,6 +141,9 @@ Treat warnings as fatal
 \fB\-\-disable\-since\-check\fR
 Do not check whether used symbols exist in local packages
 .TP
+\fB\-k\fR, \fB\-\-keep\-going\fR
+Continue as much as possible after an error
+.TP
 \fB\-\-enable\-experimental\-non\-null\fR
 Enable experimental enhancements for non\-null types
 .TP
diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala
index b2fc8eaf3..412b20eeb 100644
--- a/vala/valacodecontext.vala
+++ b/vala/valacodecontext.vala
@@ -173,6 +173,11 @@ public class Vala.CodeContext {
 
        public bool use_fast_vapi { get; set; }
 
+       /**
+        * Continue as much as possible after an error.
+        */
+       public bool keep_going { get; set; }
+
        /**
         * Include comments in generated vapi.
         */
@@ -509,13 +514,13 @@ public class Vala.CodeContext {
        public void check () {
                resolver.resolve (this);
 
-               if (report.get_errors () > 0) {
+               if (!keep_going && report.get_errors () > 0) {
                        return;
                }
 
                analyzer.analyze (this);
 
-               if (report.get_errors () > 0) {
+               if (!keep_going && report.get_errors () > 0) {
                        return;
                }
 


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