]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Properly set CodeNode.error when reporting an error (2)
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 20 Feb 2020 14:24:36 +0000 (15:24 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 20 Feb 2020 14:24:36 +0000 (15:24 +0100)
vala/valalocalvariable.vala
vala/valamemberaccess.vala
vala/valamethodcall.vala
vala/valareturnstatement.vala

index a6a1a884214971add902cee17d22f9fe0ad280d1..ec7b0da871f9b628769fd3b694f37e27cc82393e 100644 (file)
@@ -102,7 +102,10 @@ public class Vala.LocalVariable : Variable {
                                Report.error (source_reference, "'void' not supported as variable type");
                                return false;
                        }
-                       variable_type.check (context);
+                       if (!variable_type.check (context)) {
+                               error = true;
+                               return false;
+                       }
                        if (!external_package) {
                                context.analyzer.check_type (variable_type);
                        }
index 946bd2b0a892b53355ef3c863dfe189c80c02211..8b199b930a13380435a7c022e8840ecae80bffe4 100644 (file)
@@ -825,6 +825,7 @@ public class Vala.MemberAccess : Expression {
                        } else if (symbol_reference is Property) {
                                value_type = new PropertyPrototype ((Property) symbol_reference);
                        } else {
+                               error = true;
                                value_type = new InvalidType ();
                        }
 
index 4a15a6cb4ab8de48329a6b7210a69354cdb01860..98a7a878e9fade6465523e09d97435e374f333b5 100644 (file)
@@ -466,6 +466,7 @@ public class Vala.MethodCall : Expression {
                        if (format_literal != null) {
                                string format = format_literal.eval ();
                                if (!context.analyzer.check_print_format (format, arg_it, source_reference)) {
+                                       error = true;
                                        return false;
                                }
                        }
@@ -655,6 +656,7 @@ public class Vala.MethodCall : Expression {
                                // simple statements, no side effects after method call
                        } else if (!(context.analyzer.current_symbol is Block)) {
                                // can't handle errors in field initializers
+                               error = true;
                                Report.error (source_reference, "Field initializers must not throw errors");
                        } else {
                                // store parent_node as we need to replace the expression in the old parent node later on
index 07eec37c290ec360359a88ee43fcb218b09f5d72..3c069f4d542b97dfa64b5501bc59eb39be6546ed 100644 (file)
@@ -98,6 +98,7 @@ public class Vala.ReturnStatement : CodeNode, Statement {
                }
 
                if (context.analyzer.current_return_type is VoidType) {
+                       error = true;
                        Report.error (source_reference, "Return with value in void function");
                        return false;
                }