mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Renamed FunctionType::hasEqualArgumentTypes to FunctionType::hasEqualParameterTypes
This commit is contained in:
parent
13d3006376
commit
3fcd62921e
@ -231,7 +231,7 @@ vector<Declaration const*> NameAndTypeResolver::cleanedDeclarations(
|
|||||||
shared_ptr<FunctionType const> newFunctionType { d->functionType(false) };
|
shared_ptr<FunctionType const> newFunctionType { d->functionType(false) };
|
||||||
if (!newFunctionType)
|
if (!newFunctionType)
|
||||||
newFunctionType = d->functionType(true);
|
newFunctionType = d->functionType(true);
|
||||||
return newFunctionType && functionType->hasEqualArgumentTypes(*newFunctionType);
|
return newFunctionType && functionType->hasEqualParameterTypes(*newFunctionType);
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
uniqueFunctions.push_back(declaration);
|
uniqueFunctions.push_back(declaration);
|
||||||
|
@ -214,7 +214,7 @@ void TypeChecker::findDuplicateDefinitions(map<string, vector<T>> const& _defini
|
|||||||
SecondarySourceLocation ssl;
|
SecondarySourceLocation ssl;
|
||||||
|
|
||||||
for (size_t j = i + 1; j < overloads.size(); ++j)
|
for (size_t j = i + 1; j < overloads.size(); ++j)
|
||||||
if (FunctionType(*overloads[i]).hasEqualArgumentTypes(FunctionType(*overloads[j])))
|
if (FunctionType(*overloads[i]).hasEqualParameterTypes(FunctionType(*overloads[j])))
|
||||||
{
|
{
|
||||||
ssl.append("Other declaration is here:", overloads[j]->location());
|
ssl.append("Other declaration is here:", overloads[j]->location());
|
||||||
reported.insert(j);
|
reported.insert(j);
|
||||||
@ -252,7 +252,7 @@ void TypeChecker::checkContractAbstractFunctions(ContractDefinition const& _cont
|
|||||||
FunctionTypePointer funType = make_shared<FunctionType>(*function);
|
FunctionTypePointer funType = make_shared<FunctionType>(*function);
|
||||||
auto it = find_if(overloads.begin(), overloads.end(), [&](FunTypeAndFlag const& _funAndFlag)
|
auto it = find_if(overloads.begin(), overloads.end(), [&](FunTypeAndFlag const& _funAndFlag)
|
||||||
{
|
{
|
||||||
return funType->hasEqualArgumentTypes(*_funAndFlag.first);
|
return funType->hasEqualParameterTypes(*_funAndFlag.first);
|
||||||
});
|
});
|
||||||
if (it == overloads.end())
|
if (it == overloads.end())
|
||||||
overloads.push_back(make_pair(funType, function->isImplemented()));
|
overloads.push_back(make_pair(funType, function->isImplemented()));
|
||||||
@ -404,7 +404,7 @@ void TypeChecker::checkFunctionOverride(FunctionDefinition const& function, Func
|
|||||||
FunctionType functionType(function);
|
FunctionType functionType(function);
|
||||||
FunctionType superType(super);
|
FunctionType superType(super);
|
||||||
|
|
||||||
if (!functionType.hasEqualArgumentTypes(superType))
|
if (!functionType.hasEqualParameterTypes(superType))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!function.annotation().superFunction)
|
if (!function.annotation().superFunction)
|
||||||
@ -475,7 +475,7 @@ void TypeChecker::checkContractExternalTypeClashes(ContractDefinition const& _co
|
|||||||
for (auto const& it: externalDeclarations)
|
for (auto const& it: externalDeclarations)
|
||||||
for (size_t i = 0; i < it.second.size(); ++i)
|
for (size_t i = 0; i < it.second.size(); ++i)
|
||||||
for (size_t j = i + 1; j < it.second.size(); ++j)
|
for (size_t j = i + 1; j < it.second.size(); ++j)
|
||||||
if (!it.second[i].second->hasEqualArgumentTypes(*it.second[j].second))
|
if (!it.second[i].second->hasEqualParameterTypes(*it.second[j].second))
|
||||||
m_errorReporter.typeError(
|
m_errorReporter.typeError(
|
||||||
it.second[j].first->location(),
|
it.second[j].first->location(),
|
||||||
"Function overload clash during conversion to external types for arguments."
|
"Function overload clash during conversion to external types for arguments."
|
||||||
|
@ -1871,7 +1871,7 @@ MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const* _con
|
|||||||
continue;
|
continue;
|
||||||
auto memberType = dynamic_cast<FunctionType const*>(member.type.get());
|
auto memberType = dynamic_cast<FunctionType const*>(member.type.get());
|
||||||
solAssert(!!memberType, "Override changes type.");
|
solAssert(!!memberType, "Override changes type.");
|
||||||
if (!memberType->hasEqualArgumentTypes(*functionType))
|
if (!memberType->hasEqualParameterTypes(*functionType))
|
||||||
continue;
|
continue;
|
||||||
functionWithEqualArgumentsFound = true;
|
functionWithEqualArgumentsFound = true;
|
||||||
break;
|
break;
|
||||||
@ -2825,7 +2825,7 @@ bool FunctionType::canTakeArguments(TypePointers const& _argumentTypes, TypePoin
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FunctionType::hasEqualArgumentTypes(FunctionType const& _other) const
|
bool FunctionType::hasEqualParameterTypes(FunctionType const& _other) const
|
||||||
{
|
{
|
||||||
if (m_parameterTypes.size() != _other.m_parameterTypes.size())
|
if (m_parameterTypes.size() != _other.m_parameterTypes.size())
|
||||||
return false;
|
return false;
|
||||||
|
@ -1035,7 +1035,7 @@ public:
|
|||||||
/// expression the function is called on.
|
/// expression the function is called on.
|
||||||
bool canTakeArguments(TypePointers const& _arguments, TypePointer const& _selfType = TypePointer()) const;
|
bool canTakeArguments(TypePointers const& _arguments, TypePointer const& _selfType = TypePointer()) const;
|
||||||
/// @returns true if the types of parameters are equal (doesn't check return parameter types)
|
/// @returns true if the types of parameters are equal (doesn't check return parameter types)
|
||||||
bool hasEqualArgumentTypes(FunctionType const& _other) const;
|
bool hasEqualParameterTypes(FunctionType const& _other) const;
|
||||||
|
|
||||||
/// @returns true if the ABI is used for this call (only meaningful for external calls)
|
/// @returns true if the ABI is used for this call (only meaningful for external calls)
|
||||||
bool isBareCall() const;
|
bool isBareCall() const;
|
||||||
|
@ -411,7 +411,7 @@ FunctionDefinition const& CompilerContext::resolveVirtualFunction(
|
|||||||
if (
|
if (
|
||||||
function->name() == name &&
|
function->name() == name &&
|
||||||
!function->isConstructor() &&
|
!function->isConstructor() &&
|
||||||
FunctionType(*function).hasEqualArgumentTypes(functionType)
|
FunctionType(*function).hasEqualParameterTypes(functionType)
|
||||||
)
|
)
|
||||||
return *function;
|
return *function;
|
||||||
solAssert(false, "Super function " + name + " not found.");
|
solAssert(false, "Super function " + name + " not found.");
|
||||||
|
Loading…
Reference in New Issue
Block a user