[vala/0.46] vala: Don't ignore inner errors in Block and acknowledge them further



commit d0de8f9247e714bb057e13495f6014d15c201fe4
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Nov 27 11:42:55 2019 +0100

    vala: Don't ignore inner errors in Block and acknowledge them further
    
    This avoids useless subsequent errors and possible criticals while
    operating on broken AST.

 vala/valablock.vala          | 4 +++-
 vala/valacreationmethod.vala | 2 +-
 vala/valamethod.vala         | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/vala/valablock.vala b/vala/valablock.vala
index 7419b5b9d..e3b6ff185 100644
--- a/vala/valablock.vala
+++ b/vala/valablock.vala
@@ -159,7 +159,9 @@ public class Vala.Block : Symbol, Statement {
                context.analyzer.insert_block = this;
 
                for (int i = 0; i < statement_list.size; i++) {
-                       statement_list[i].check (context);
+                       if (!statement_list[i].check (context)) {
+                               error = true;
+                       }
                }
 
                foreach (LocalVariable local in get_local_variables ()) {
diff --git a/vala/valacreationmethod.vala b/vala/valacreationmethod.vala
index ae8daab38..86e089457 100644
--- a/vala/valacreationmethod.vala
+++ b/vala/valacreationmethod.vala
@@ -175,7 +175,7 @@ public class Vala.CreationMethod : Method {
                }
 
                // check that all errors that can be thrown in the method body are declared
-               if (body != null) {
+               if (body != null && !body.error) {
                        var body_errors = new ArrayList<DataType> ();
                        body.get_error_types (body_errors);
                        foreach (DataType body_error_type in body_errors) {
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index d4307f5cc..73e22c3ff 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -947,7 +947,7 @@ public class Vala.Method : Subroutine, Callable {
                }
 
                // check that all errors that can be thrown in the method body are declared
-               if (body != null) {
+               if (body != null && !body.error) {
                        var body_errors = new ArrayList<DataType> ();
                        body.get_error_types (body_errors);
                        foreach (DataType body_error_type in body_errors) {


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