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



commit 69e1e66249af956ebde1de087e04d15ad0617b99
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 4064b6e90..53186c006 100644
--- a/vala/valablock.vala
+++ b/vala/valablock.vala
@@ -150,7 +150,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 4d905348f..bd2acb243 100644
--- a/vala/valacreationmethod.vala
+++ b/vala/valacreationmethod.vala
@@ -170,7 +170,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) {
                        foreach (DataType body_error_type in body.get_error_types ()) {
                                bool can_propagate_error = false;
                                foreach (DataType method_error_type in get_error_types ()) {
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index a0067297e..2f7185b2a 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -857,7 +857,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) {
                        foreach (DataType body_error_type in body.get_error_types ()) {
                                bool can_propagate_error = false;
                                foreach (DataType method_error_type in get_error_types ()) {


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