mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Warn on unused local variables
Analyze functions for all local variables, parameters, and named return variables which are never used in the function, and issue a warning.
This commit is contained in:
@@ -61,6 +61,8 @@ private:
|
||||
virtual void endVisit(FunctionDefinition const& _function) override;
|
||||
|
||||
virtual bool visit(ExpressionStatement const& _statement) override;
|
||||
virtual bool visit(VariableDeclaration const& _variable) override;
|
||||
virtual bool visit(Identifier const& _identifier) override;
|
||||
|
||||
virtual bool visit(MemberAccess const& _memberAccess) override;
|
||||
|
||||
@@ -71,6 +73,10 @@ private:
|
||||
|
||||
/// Flag that indicates whether a public function does not contain the "payable" modifier.
|
||||
bool m_nonPayablePublic = false;
|
||||
|
||||
std::map<VariableDeclaration const*, int> m_localVarUseCount;
|
||||
|
||||
bool m_inFunction = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user