Fix scoping following try/catch.

This commit is contained in:
chriseth
2020-03-09 13:14:13 +01:00
parent b1e43833c7
commit 37e01a19c0
4 changed files with 29 additions and 0 deletions
@@ -67,6 +67,22 @@ void ReferencesResolver::endVisit(Block const& _block)
m_resolver.setScope(_block.scope());
}
bool ReferencesResolver::visit(TryCatchClause const& _tryCatchClause)
{
if (!m_resolveInsideCode)
return false;
m_resolver.setScope(&_tryCatchClause);
return true;
}
void ReferencesResolver::endVisit(TryCatchClause const& _tryCatchClause)
{
if (!m_resolveInsideCode)
return;
m_resolver.setScope(_tryCatchClause.scope());
}
bool ReferencesResolver::visit(ForStatement const& _for)
{
if (!m_resolveInsideCode)
@@ -70,6 +70,8 @@ private:
bool visit(Block const& _block) override;
void endVisit(Block const& _block) override;
bool visit(TryCatchClause const& _tryCatchClause) override;
void endVisit(TryCatchClause const& _tryCatchClause) override;
bool visit(ForStatement const& _for) override;
void endVisit(ForStatement const& _for) override;
void endVisit(VariableDeclarationStatement const& _varDeclStatement) override;