Improve parent signature error
This commit is contained in:
parent
0ff8742919
commit
d1e4146462
6 changed files with 15 additions and 11 deletions
|
@ -1214,11 +1214,7 @@ void GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode *
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
// Compute parent signature as a string to show in the error message.
|
// Compute parent signature as a string to show in the error message.
|
||||||
String parent_signature = parent_return_type.is_hard_type() ? parent_return_type.to_string() : "Variant";
|
String parent_signature = p_function->identifier->name.operator String() + "(";
|
||||||
if (parent_signature == "null") {
|
|
||||||
parent_signature = "void";
|
|
||||||
}
|
|
||||||
parent_signature += " " + p_function->identifier->name.operator String() + "(";
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (const GDScriptParser::DataType &par_type : parameters_types) {
|
for (const GDScriptParser::DataType &par_type : parameters_types) {
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
|
@ -1235,7 +1231,15 @@ void GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode *
|
||||||
|
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
parent_signature += ")";
|
parent_signature += ") -> ";
|
||||||
|
|
||||||
|
const String return_type = parent_return_type.is_hard_type() ? parent_return_type.to_string() : "Variant";
|
||||||
|
if (return_type == "null") {
|
||||||
|
parent_signature += "void";
|
||||||
|
} else {
|
||||||
|
parent_signature += return_type;
|
||||||
|
}
|
||||||
|
|
||||||
push_error(vformat(R"(The function signature doesn't match the parent. Parent signature is "%s".)", parent_signature), p_function);
|
push_error(vformat(R"(The function signature doesn't match the parent. Parent signature is "%s".)", parent_signature), p_function);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
GDTEST_ANALYZER_ERROR
|
GDTEST_ANALYZER_ERROR
|
||||||
The function signature doesn't match the parent. Parent signature is "int my_function(int)".
|
The function signature doesn't match the parent. Parent signature is "my_function(int) -> int".
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
GDTEST_ANALYZER_ERROR
|
GDTEST_ANALYZER_ERROR
|
||||||
The function signature doesn't match the parent. Parent signature is "int my_function(int)".
|
The function signature doesn't match the parent. Parent signature is "my_function(int) -> int".
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
GDTEST_ANALYZER_ERROR
|
GDTEST_ANALYZER_ERROR
|
||||||
The function signature doesn't match the parent. Parent signature is "int my_function(int = default)".
|
The function signature doesn't match the parent. Parent signature is "my_function(int = default) -> int".
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
GDTEST_ANALYZER_ERROR
|
GDTEST_ANALYZER_ERROR
|
||||||
The function signature doesn't match the parent. Parent signature is "int my_function(int)".
|
The function signature doesn't match the parent. Parent signature is "my_function(int) -> int".
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
GDTEST_ANALYZER_ERROR
|
GDTEST_ANALYZER_ERROR
|
||||||
The function signature doesn't match the parent. Parent signature is "int my_function()".
|
The function signature doesn't match the parent. Parent signature is "my_function() -> int".
|
||||||
|
|
Loading…
Reference in a new issue