aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis/StaticAnalyzer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity/analysis/StaticAnalyzer.cpp')
-rw-r--r--libsolidity/analysis/StaticAnalyzer.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/libsolidity/analysis/StaticAnalyzer.cpp b/libsolidity/analysis/StaticAnalyzer.cpp
index 55e7cb59..21c97c3b 100644
--- a/libsolidity/analysis/StaticAnalyzer.cpp
+++ b/libsolidity/analysis/StaticAnalyzer.cpp
@@ -50,6 +50,7 @@ bool StaticAnalyzer::visit(FunctionDefinition const& _function)
{
if (_function.isImplemented())
m_inFunction = true;
+ m_currentFunction = &_function;
m_localVarUseCount.clear();
m_nonPayablePublic = _function.isPublic() && !_function.isPayable();
return true;
@@ -96,6 +97,17 @@ bool StaticAnalyzer::visit(VariableDeclaration const& _variable)
return true;
}
+bool StaticAnalyzer::visit(Return const& _return)
+{
+ // If the return has an expression, it counts as
+ // a "use" of the return parameters.
+ if (m_inFunction && _return.expression() != NULL)
+ for (auto const& var: m_currentFunction->returnParameterList()->parameters())
+ if (var->name() != "")
+ m_localVarUseCount[var.get()] += 1;
+ return true;
+}
+
bool StaticAnalyzer::visit(ExpressionStatement const& _statement)
{
if (_statement.expression().annotation().isPure)