[vala/0.42] vala: Make check_arguments() more verbose and don't bail on first error
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.42] vala: Make check_arguments() more verbose and don't bail on first error
- Date: Thu, 6 Dec 2018 11:27:24 +0000 (UTC)
commit 69cd0041d2f8aced2c7a7d9f7ebc523dafc73d62
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Nov 27 16:11:29 2018 +0100
vala: Make check_arguments() more verbose and don't bail on first error
Fixes https://gitlab.gnome.org/GNOME/vala/issues/438
vala/valasemanticanalyzer.vala | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index 3a5dea6fe..139103b89 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -407,6 +407,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
}
public bool check_arguments (Expression expr, DataType mtype, List<Parameter> params,
List<Expression> args) {
+ bool error = false;
+
Expression prev_arg = null;
Iterator<Expression> arg_it = args.iterator ();
@@ -425,7 +427,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
var arg = arg_it.get ();
if (!check_argument (arg, i, param.direction)) {
expr.error = true;
- return false;
+ error = true;
}
i++;
@@ -443,7 +445,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
} else {
Report.error (expr.source_reference, "Too few arguments,
method `%s' does not take %d arguments".printf (mtype.to_string (), args.size));
}
- return false;
+ error = true;
} else {
var invocation_expr = expr as MethodCall;
var object_creation_expr = expr as ObjectCreationExpression;
@@ -460,7 +462,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
var arg = arg_it.get ();
if (!check_argument (arg, i, param.direction)) {
expr.error = true;
- return false;
+ error = true;
}
prev_arg = arg;
@@ -471,7 +473,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
if (ellipsis && !check_variadic_arguments (arg_it, i, expr.source_reference)) {
expr.error = true;
- return false;
+ error = true;
} else if (!ellipsis && arg_it != null && arg_it.next ()) {
expr.error = true;
var m = mtype as MethodType;
@@ -480,7 +482,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
} else {
Report.error (expr.source_reference, "Too many arguments, method `%s' does
not take %d arguments".printf (mtype.to_string (), args.size));
}
- return false;
+ error = true;
}
if (diag && prev_arg != null) {
@@ -490,7 +492,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
}
}
- return true;
+ return !error;
}
bool check_argument (Expression arg, int i, ParameterDirection direction) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]