Properly detect name clashes with functions before their definition.

This commit is contained in:
chriseth
2019-02-18 14:51:05 +01:00
parent db7b38e3c4
commit b4cd2d6a93
3 changed files with 35 additions and 3 deletions
+9 -2
View File
@@ -150,9 +150,16 @@ bool ScopeFiller::operator()(Block const& _block)
scope(&_block).superScope = m_currentScope;
m_currentScope = &scope(&_block);
// First visit all functions to make them create
// an entry in the scope according to their visibility.
for (auto const& s: _block.statements)
if (!boost::apply_visitor(*this, s))
success = false;
if (s.type() == typeid(FunctionDefinition))
if (!boost::apply_visitor(*this, s))
success = false;
for (auto const& s: _block.statements)
if (s.type() != typeid(FunctionDefinition))
if (!boost::apply_visitor(*this, s))
success = false;
m_currentScope = m_currentScope->superScope;
return success;