|
@ -53,12 +53,12 @@ void NameAndTypeResolver::resolveNamesAndTypes(ContractDefinition& _contract) |
|
|
m_currentScope = &m_scopes[&_contract]; |
|
|
m_currentScope = &m_scopes[&_contract]; |
|
|
|
|
|
|
|
|
linearizeBaseContracts(_contract); |
|
|
linearizeBaseContracts(_contract); |
|
|
std::vector<ContractDefinition const*> realBases( |
|
|
std::vector<ContractDefinition const*> properBases( |
|
|
++_contract.getLinearizedBaseContracts().begin(), |
|
|
++_contract.getLinearizedBaseContracts().begin(), |
|
|
_contract.getLinearizedBaseContracts().end() |
|
|
_contract.getLinearizedBaseContracts().end() |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
for (ContractDefinition const* base: realBases) |
|
|
for (ContractDefinition const* base: properBases) |
|
|
importInheritedScope(*base); |
|
|
importInheritedScope(*base); |
|
|
|
|
|
|
|
|
for (ASTPointer<StructDefinition> const& structDef: _contract.getDefinedStructs()) |
|
|
for (ASTPointer<StructDefinition> const& structDef: _contract.getDefinedStructs()) |
|
@ -130,11 +130,12 @@ vector<Declaration const*> NameAndTypeResolver::getNameFromCurrentScope(ASTStrin |
|
|
return m_currentScope->resolveName(_name, _recursive); |
|
|
return m_currentScope->resolveName(_name, _recursive); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
vector<Declaration const*> NameAndTypeResolver::cleanupedDeclarations( |
|
|
vector<Declaration const*> NameAndTypeResolver::cleanedDeclarations( |
|
|
Identifier const& _identifier, |
|
|
Identifier const& _identifier, |
|
|
vector<Declaration const*> const& _declarations |
|
|
vector<Declaration const*> const& _declarations |
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
|
|
|
solAssert(_declarations.size() > 1, ""); |
|
|
vector<Declaration const*> uniqueFunctions; |
|
|
vector<Declaration const*> uniqueFunctions; |
|
|
|
|
|
|
|
|
for (auto it = _declarations.begin(); it != _declarations.end(); ++it) |
|
|
for (auto it = _declarations.begin(); it != _declarations.end(); ++it) |
|
@ -143,7 +144,7 @@ vector<Declaration const*> NameAndTypeResolver::cleanupedDeclarations( |
|
|
// the declaration is functionDefinition while declarations > 1
|
|
|
// the declaration is functionDefinition while declarations > 1
|
|
|
FunctionDefinition const& functionDefinition = dynamic_cast<FunctionDefinition const&>(**it); |
|
|
FunctionDefinition const& functionDefinition = dynamic_cast<FunctionDefinition const&>(**it); |
|
|
FunctionType functionType(functionDefinition); |
|
|
FunctionType functionType(functionDefinition); |
|
|
for(auto parameter: functionType.getParameterTypes() + functionType.getReturnParameterTypes()) |
|
|
for (auto parameter: functionType.getParameterTypes() + functionType.getReturnParameterTypes()) |
|
|
if (!parameter) |
|
|
if (!parameter) |
|
|
BOOST_THROW_EXCEPTION( |
|
|
BOOST_THROW_EXCEPTION( |
|
|
DeclarationError() << |
|
|
DeclarationError() << |
|
@ -155,9 +156,7 @@ vector<Declaration const*> NameAndTypeResolver::cleanupedDeclarations( |
|
|
uniqueFunctions.end(), |
|
|
uniqueFunctions.end(), |
|
|
[&](Declaration const* d) |
|
|
[&](Declaration const* d) |
|
|
{ |
|
|
{ |
|
|
FunctionDefinition const& newFunctionDefinition = dynamic_cast<FunctionDefinition const&>(*d); |
|
|
FunctionType newFunctionType(dynamic_cast<FunctionDefinition const&>(*d)); |
|
|
FunctionType newFunctionType(newFunctionDefinition); |
|
|
|
|
|
|
|
|
|
|
|
return functionType.hasEqualArgumentTypes(newFunctionType); |
|
|
return functionType.hasEqualArgumentTypes(newFunctionType); |
|
|
} |
|
|
} |
|
|
)) |
|
|
)) |
|
@ -482,7 +481,7 @@ bool ReferencesResolver::visit(Identifier& _identifier) |
|
|
else if (declarations.size() == 1) |
|
|
else if (declarations.size() == 1) |
|
|
_identifier.setReferencedDeclaration(*declarations.front(), m_currentContract); |
|
|
_identifier.setReferencedDeclaration(*declarations.front(), m_currentContract); |
|
|
else |
|
|
else |
|
|
_identifier.setOverloadedDeclarations(m_resolver.cleanupedDeclarations(_identifier, declarations)); |
|
|
_identifier.setOverloadedDeclarations(m_resolver.cleanedDeclarations(_identifier, declarations)); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|