Skip to content

Commit

Permalink
Add boolean CodeContext.keep_going and corresponding compiler option
Browse files Browse the repository at this point in the history
If keep_going is set then check() will continue after hitting errors in
resolver and analyzer.
  • Loading branch information
ricotz committed Sep 2, 2019
1 parent aaa657e commit 1430c46
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions compiler/valacompiler.vala
Expand Up @@ -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;
Expand Down Expand Up @@ -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" },
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions doc/valac.1
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions vala/valacodecontext.vala
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 1430c46

Please sign in to comment.