]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Don't ignore inner errors in Block and acknowledge them further
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 27 Nov 2019 10:42:55 +0000 (11:42 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 27 Nov 2019 12:30:25 +0000 (13:30 +0100)
This avoids useless subsequent errors and possible criticals while
operating on broken AST.

vala/valablock.vala
vala/valacreationmethod.vala
vala/valamethod.vala

index c4e8ab74e299db2f3c3c8fddded0e7cb3a70e078..a702ea0117bca185e7bd3285255b9ab4021428ee 100644 (file)
@@ -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 ()) {
index 5969fd3986aa30a90854d0015f5364def625f708..3c0b229929348c21e92ca67c229323761c4c0c5f 100644 (file)
@@ -179,7 +179,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) {
index a105a0d0f94d5564e0108651afba20880ea8640d..1be97ab21f2ee6f5920e609fa4a9ce3ede42baab 100644 (file)
@@ -954,7 +954,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) {