aboutsummaryrefslogtreecommitdiffstats
path: root/NameAndTypeResolver.cpp
diff options
context:
space:
mode:
authorLiana Husikyan <liana@ethdev.com>2015-05-08 22:07:25 +0800
committerLiana Husikyan <liana@ethdev.com>2015-05-08 23:51:53 +0800
commit5c1c690e286e4086eb60ef392b816c536e7b1839 (patch)
tree719712fe3e716c5d2ca56d6b9f3be1e4c5402b09 /NameAndTypeResolver.cpp
parente7568b5f4d7b07f5b36890852abce7d1b51f9124 (diff)
downloaddexon-solidity-5c1c690e286e4086eb60ef392b816c536e7b1839.tar.gz
dexon-solidity-5c1c690e286e4086eb60ef392b816c536e7b1839.tar.zst
dexon-solidity-5c1c690e286e4086eb60ef392b816c536e7b1839.zip
style changes
Diffstat (limited to 'NameAndTypeResolver.cpp')
-rw-r--r--NameAndTypeResolver.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/NameAndTypeResolver.cpp b/NameAndTypeResolver.cpp
index 21b33292..5ef14f60 100644
--- a/NameAndTypeResolver.cpp
+++ b/NameAndTypeResolver.cpp
@@ -53,12 +53,12 @@ void NameAndTypeResolver::resolveNamesAndTypes(ContractDefinition& _contract)
m_currentScope = &m_scopes[&_contract];
linearizeBaseContracts(_contract);
- std::vector<ContractDefinition const*> realBases(
+ std::vector<ContractDefinition const*> properBases(
++_contract.getLinearizedBaseContracts().begin(),
_contract.getLinearizedBaseContracts().end()
);
- for (ContractDefinition const* base: realBases)
+ for (ContractDefinition const* base: properBases)
importInheritedScope(*base);
for (ASTPointer<StructDefinition> const& structDef: _contract.getDefinedStructs())
@@ -130,11 +130,12 @@ vector<Declaration const*> NameAndTypeResolver::getNameFromCurrentScope(ASTStrin
return m_currentScope->resolveName(_name, _recursive);
}
-vector<Declaration const*> NameAndTypeResolver::cleanupedDeclarations(
+vector<Declaration const*> NameAndTypeResolver::cleanedDeclarations(
Identifier const& _identifier,
vector<Declaration const*> const& _declarations
)
{
+ solAssert(_declarations.size() > 1, "");
vector<Declaration const*> uniqueFunctions;
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
FunctionDefinition const& functionDefinition = dynamic_cast<FunctionDefinition const&>(**it);
FunctionType functionType(functionDefinition);
- for(auto parameter: functionType.getParameterTypes() + functionType.getReturnParameterTypes())
+ for (auto parameter: functionType.getParameterTypes() + functionType.getReturnParameterTypes())
if (!parameter)
BOOST_THROW_EXCEPTION(
DeclarationError() <<
@@ -155,9 +156,7 @@ vector<Declaration const*> NameAndTypeResolver::cleanupedDeclarations(
uniqueFunctions.end(),
[&](Declaration const* d)
{
- FunctionDefinition const& newFunctionDefinition = dynamic_cast<FunctionDefinition const&>(*d);
- FunctionType newFunctionType(newFunctionDefinition);
-
+ FunctionType newFunctionType(dynamic_cast<FunctionDefinition const&>(*d));
return functionType.hasEqualArgumentTypes(newFunctionType);
}
))
@@ -482,7 +481,7 @@ bool ReferencesResolver::visit(Identifier& _identifier)
else if (declarations.size() == 1)
_identifier.setReferencedDeclaration(*declarations.front(), m_currentContract);
else
- _identifier.setOverloadedDeclarations(m_resolver.cleanupedDeclarations(_identifier, declarations));
+ _identifier.setOverloadedDeclarations(m_resolver.cleanedDeclarations(_identifier, declarations));
return false;
}