aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity/interface')
-rw-r--r--libsolidity/interface/CompilerStack.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp
index a31df584..5d4ccd92 100644
--- a/libsolidity/interface/CompilerStack.cpp
+++ b/libsolidity/interface/CompilerStack.cpp
@@ -180,6 +180,15 @@ bool CompilerStack::parse()
if (!resolver.updateDeclaration(*m_globalContext->currentThis())) return false;
if (!resolver.updateDeclaration(*m_globalContext->currentSuper())) return false;
if (!resolver.resolveNamesAndTypes(*contract)) return false;
+ if (m_contracts.find(contract->name()) != m_contracts.end())
+ {
+ const ContractDefinition* existingContract = m_contracts.find(contract->name())->second.contract;
+ if (contract != existingContract)
+ BOOST_THROW_EXCEPTION(CompilerError() <<
+ errinfo_sourceLocation(contract->location()) <<
+ errinfo_comment(contract->name() + " conflicts with contract at "
+ + *(existingContract->location().sourceName)));
+ }
m_contracts[contract->name()].contract = contract;
}
@@ -201,6 +210,16 @@ bool CompilerStack::parse()
else
noErrors = false;
+ if (m_contracts.find(contract->name()) != m_contracts.end())
+ {
+ const ContractDefinition* existingContract = m_contracts.find(contract->name())->second.contract;
+ if (contract != existingContract)
+ BOOST_THROW_EXCEPTION(CompilerError() <<
+ errinfo_sourceLocation(contract->location()) <<
+ errinfo_comment(contract->name() + " conflicts with!!! contract at "
+ + *(existingContract->location().sourceName)));
+ }
+
m_contracts[contract->name()].contract = contract;
}