diff options
author | chriseth <c@ethdev.com> | 2015-04-22 01:04:08 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-04-22 01:04:08 +0800 |
commit | a44bcb6909478543151cac871fdbbc4909ad54aa (patch) | |
tree | 4e18e218acfa907c9cf5b6103dee3050a4031526 /DeclarationContainer.cpp | |
parent | 1f44d93e052d9a8b22d362fba2493f5c7dfa38d2 (diff) | |
download | dexon-solidity-a44bcb6909478543151cac871fdbbc4909ad54aa.tar.gz dexon-solidity-a44bcb6909478543151cac871fdbbc4909ad54aa.tar.zst dexon-solidity-a44bcb6909478543151cac871fdbbc4909ad54aa.zip |
Fix for declarations.
Diffstat (limited to 'DeclarationContainer.cpp')
-rw-r--r-- | DeclarationContainer.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/DeclarationContainer.cpp b/DeclarationContainer.cpp index 5f8d24e3..2130f3a0 100644 --- a/DeclarationContainer.cpp +++ b/DeclarationContainer.cpp @@ -37,19 +37,25 @@ bool DeclarationContainer::registerDeclaration(Declaration const& _declaration, if (_update) { solAssert(!dynamic_cast<FunctionDefinition const*>(&_declaration), "Attempt to update function definition."); - m_declarations[name].clear(); - m_invisibleDeclarations[name].clear(); + m_declarations.erase(name); + m_invisibleDeclarations.erase(name); } else { + vector<Declaration const*> declarations; + if (m_declarations.count(name)) + declarations += m_declarations.at(name); + if (m_invisibleDeclarations.count(name)) + declarations += m_invisibleDeclarations.at(name); if (dynamic_cast<FunctionDefinition const*>(&_declaration)) { // check that all other declarations with the same name are functions - for (auto&& declaration: m_invisibleDeclarations[name] + m_declarations[name]) + + for (Declaration const* declaration: declarations) if (!dynamic_cast<FunctionDefinition const*>(declaration)) return false; } - else if (m_declarations.count(name) > 0 || m_invisibleDeclarations.count(name) > 0) + else if (!declarations.empty()) return false; } |