aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis/DeclarationContainer.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-01-11 20:55:58 +0800
committerchriseth <c@ethdev.com>2016-01-11 20:56:02 +0800
commitf20a604c5a941ed5117d3e472b5ad93bed02fd97 (patch)
tree0e08a74d3432787f135fbd471b5cdf3fa1251321 /libsolidity/analysis/DeclarationContainer.cpp
parentaa645d11927dce715ed3507e4b2ae89cf984a488 (diff)
downloaddexon-solidity-f20a604c5a941ed5117d3e472b5ad93bed02fd97.tar.gz
dexon-solidity-f20a604c5a941ed5117d3e472b5ad93bed02fd97.tar.zst
dexon-solidity-f20a604c5a941ed5117d3e472b5ad93bed02fd97.zip
Allow aliases during import.
Diffstat (limited to 'libsolidity/analysis/DeclarationContainer.cpp')
-rw-r--r--libsolidity/analysis/DeclarationContainer.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/libsolidity/analysis/DeclarationContainer.cpp b/libsolidity/analysis/DeclarationContainer.cpp
index ac56562e..042b7a6a 100644
--- a/libsolidity/analysis/DeclarationContainer.cpp
+++ b/libsolidity/analysis/DeclarationContainer.cpp
@@ -49,6 +49,8 @@ Declaration const* DeclarationContainer::conflictingDeclaration(
if (!dynamic_cast<FunctionDefinition const*>(declaration))
return declaration;
}
+ else if (declarations.size() == 1 && declarations.front() == &_declaration)
+ return nullptr;
else if (!declarations.empty())
return declarations.front();
@@ -73,13 +75,12 @@ bool DeclarationContainer::registerDeclaration(
m_declarations.erase(*_name);
m_invisibleDeclarations.erase(*_name);
}
- else if (conflictingDeclaration(_declaration))
+ else if (conflictingDeclaration(_declaration, _name))
return false;
- if (_invisible)
- m_invisibleDeclarations[*_name].push_back(&_declaration);
- else
- m_declarations[*_name].push_back(&_declaration);
+ vector<Declaration const*>& decls = _invisible ? m_invisibleDeclarations[*_name] : m_declarations[*_name];
+ if (!contains(decls, &_declaration))
+ decls.push_back(&_declaration);
return true;
}