Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't warn for UNUSED_PARAMETER in _process and _physics_process functions regarding delta #97170

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions modules/gdscript/gdscript_analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1687,8 +1687,15 @@ void GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode *
for (int i = 0; i < p_function->parameters.size(); i++) {
resolve_parameter(p_function->parameters[i]);
#ifdef DEBUG_ENABLED
if (p_function->parameters[i]->usages == 0 && !String(p_function->parameters[i]->identifier->name).begins_with("_")) {
parser->push_warning(p_function->parameters[i]->identifier, GDScriptWarning::UNUSED_PARAMETER, function_visible_name, p_function->parameters[i]->identifier->name);
GDScriptParser::ParameterNode *parameter = p_function->parameters[i];
StringName parameter_name = parameter->identifier->name;
if (parameter->usages == 0 && !String(parameter_name).begins_with("_")) {
bool is_process_function = function_name == "_process" || function_name == "_physics_process";
bool only_has_delta_parameter = p_function->parameters.size() == 1 && parameter_name == "delta";
bool should_ignore = is_process_function && only_has_delta_parameter;
if (!should_ignore) {
parser->push_warning(p_function->parameters[i]->identifier, GDScriptWarning::UNUSED_PARAMETER, function_visible_name, p_function->parameters[i]->identifier->name);
}
}
is_shadowing(p_function->parameters[i]->identifier, "function parameter", true);
#endif // DEBUG_ENABLED
Expand Down
Loading