mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #5325 from ethereum/fixDataFlow
[Yul] Fix data flow analyzer for function definitions.
This commit is contained in:
@@ -84,13 +84,26 @@ void DataFlowAnalyzer::operator()(Switch& _switch)
|
||||
|
||||
void DataFlowAnalyzer::operator()(FunctionDefinition& _fun)
|
||||
{
|
||||
// Save all information. We might rather reinstantiate this class,
|
||||
// but this could be difficult if it is subclassed.
|
||||
map<YulString, Expression const*> value;
|
||||
map<YulString, set<YulString>> references;
|
||||
map<YulString, set<YulString>> referencedBy;
|
||||
m_value.swap(value);
|
||||
m_references.swap(references);
|
||||
m_referencedBy.swap(referencedBy);
|
||||
pushScope(true);
|
||||
|
||||
for (auto const& parameter: _fun.parameters)
|
||||
m_variableScopes.back().variables.emplace(parameter.name);
|
||||
for (auto const& var: _fun.returnVariables)
|
||||
m_variableScopes.back().variables.emplace(var.name);
|
||||
ASTModifier::operator()(_fun);
|
||||
|
||||
popScope();
|
||||
m_value.swap(value);
|
||||
m_references.swap(references);
|
||||
m_referencedBy.swap(referencedBy);
|
||||
}
|
||||
|
||||
void DataFlowAnalyzer::operator()(ForLoop& _for)
|
||||
|
||||
Reference in New Issue
Block a user