[vala/0.40] vala: Properly set CodeNode.error when reporting an error (2)



commit bfa428b0607b48f90b7326f1cae6ce641dfdefaa
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Feb 20 15:24:36 2020 +0100

    vala: Properly set CodeNode.error when reporting an error (2)

 vala/valalocalvariable.vala   | 5 ++++-
 vala/valamemberaccess.vala    | 1 +
 vala/valamethodcall.vala      | 2 ++
 vala/valareturnstatement.vala | 1 +
 4 files changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/vala/valalocalvariable.vala b/vala/valalocalvariable.vala
index fed098cf5..18d6652b8 100644
--- a/vala/valalocalvariable.vala
+++ b/vala/valalocalvariable.vala
@@ -85,7 +85,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;
+                       }
                }
 
                // Catch initializer list transformation:
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 9b9988400..6cc837749 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -797,6 +797,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 ();
                        }
 
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index 0595e98da..c030f1198 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -446,6 +446,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;
                                }
                        }
@@ -652,6 +653,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
diff --git a/vala/valareturnstatement.vala b/vala/valareturnstatement.vala
index c961e4ea0..1670e59e3 100644
--- a/vala/valareturnstatement.vala
+++ b/vala/valareturnstatement.vala
@@ -92,6 +92,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;
                }


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