[vala/0.46] vala: Properly set CodeNode.error when reporting an error (2)
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.46] vala: Properly set CodeNode.error when reporting an error (2)
- Date: Thu, 5 Mar 2020 18:46:30 +0000 (UTC)
commit ef09a9f335d126d65551d2cfd538e1e84cee3d4d
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 e350413f9..aa4bb3a91 100644
--- a/vala/valalocalvariable.vala
+++ b/vala/valalocalvariable.vala
@@ -98,7 +98,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 7cb968dfe..7f9390dd8 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -794,6 +794,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 5996e7a55..baa451e20 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -471,6 +471,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;
}
}
@@ -660,6 +661,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 c6254849b..74d5b33c3 100644
--- a/vala/valareturnstatement.vala
+++ b/vala/valareturnstatement.vala
@@ -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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]