mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Display helpful warning for unused function arguments/return parameters
This commit is contained in:
@@ -69,7 +69,16 @@ void StaticAnalyzer::endVisit(FunctionDefinition const&)
|
||||
m_constructor = false;
|
||||
for (auto const& var: m_localVarUseCount)
|
||||
if (var.second == 0)
|
||||
m_errorReporter.warning(var.first->location(), "Unused local variable");
|
||||
{
|
||||
if (var.first->isCallableParameter())
|
||||
m_errorReporter.warning(
|
||||
var.first->location(),
|
||||
"Unused function parameter. Remove or comment out the variable name to silence this warning."
|
||||
);
|
||||
else
|
||||
m_errorReporter.warning(var.first->location(), "Unused local variable.");
|
||||
}
|
||||
|
||||
m_localVarUseCount.clear();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user