[vala/0.36] 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.36] vala: Make check_arguments() more verbose and don't bail on first error
- Date: Thu, 6 Dec 2018 15:04:26 +0000 (UTC)
commit 992fe1d4117135721a688a0403ae55855f87c1e8
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 dbef191aa..2ecf5af20 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 ();
@@ -429,7 +431,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++;
@@ -447,7 +449,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;
@@ -464,7 +466,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;
@@ -475,7 +477,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;
@@ -484,7 +486,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) {
@@ -494,7 +496,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]