mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Rename asCallableFunction.
This commit is contained in:
parent
e6b399c86e
commit
9604174151
@ -41,8 +41,8 @@ bool hasEqualNameAndParameters(T const& _a, B const& _b)
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
_a.name() == _b.name() &&
|
_a.name() == _b.name() &&
|
||||||
FunctionType(_a).asCallableFunction(false)->hasEqualParameterTypes(
|
FunctionType(_a).asExternallyCallableFunction(false)->hasEqualParameterTypes(
|
||||||
*FunctionType(_b).asCallableFunction(false)
|
*FunctionType(_b).asExternallyCallableFunction(false)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ void ContractLevelChecker::checkExternalTypeClashes(ContractDefinition const& _c
|
|||||||
// under non error circumstances this should be true
|
// under non error circumstances this should be true
|
||||||
if (functionType->interfaceFunctionType())
|
if (functionType->interfaceFunctionType())
|
||||||
externalDeclarations[functionType->externalSignature()].emplace_back(
|
externalDeclarations[functionType->externalSignature()].emplace_back(
|
||||||
f, functionType->asCallableFunction(false)
|
f, functionType->asExternallyCallableFunction(false)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
for (VariableDeclaration const* v: contract->stateVariables())
|
for (VariableDeclaration const* v: contract->stateVariables())
|
||||||
@ -355,7 +355,7 @@ void ContractLevelChecker::checkExternalTypeClashes(ContractDefinition const& _c
|
|||||||
// under non error circumstances this should be true
|
// under non error circumstances this should be true
|
||||||
if (functionType->interfaceFunctionType())
|
if (functionType->interfaceFunctionType())
|
||||||
externalDeclarations[functionType->externalSignature()].emplace_back(
|
externalDeclarations[functionType->externalSignature()].emplace_back(
|
||||||
v, functionType->asCallableFunction(false)
|
v, functionType->asExternallyCallableFunction(false)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -311,8 +311,8 @@ Token OverrideProxy::functionKind() const
|
|||||||
FunctionType const* OverrideProxy::functionType() const
|
FunctionType const* OverrideProxy::functionType() const
|
||||||
{
|
{
|
||||||
return std::visit(GenericVisitor{
|
return std::visit(GenericVisitor{
|
||||||
[&](FunctionDefinition const* _item) { return FunctionType(*_item).asCallableFunction(false); },
|
[&](FunctionDefinition const* _item) { return FunctionType(*_item).asExternallyCallableFunction(false); },
|
||||||
[&](VariableDeclaration const* _item) { return FunctionType(*_item).asCallableFunction(false); },
|
[&](VariableDeclaration const* _item) { return FunctionType(*_item).asExternallyCallableFunction(false); },
|
||||||
[&](ModifierDefinition const*) -> FunctionType const* { solAssert(false, "Requested function type of modifier."); return nullptr; }
|
[&](ModifierDefinition const*) -> FunctionType const* { solAssert(false, "Requested function type of modifier."); return nullptr; }
|
||||||
}, m_item);
|
}, m_item);
|
||||||
}
|
}
|
||||||
|
@ -340,7 +340,7 @@ TypePointer FunctionDefinition::typeViaContractName() const
|
|||||||
if (annotation().contract->isLibrary())
|
if (annotation().contract->isLibrary())
|
||||||
{
|
{
|
||||||
if (isPublic())
|
if (isPublic())
|
||||||
return FunctionType(*this).asCallableFunction(true);
|
return FunctionType(*this).asExternallyCallableFunction(true);
|
||||||
else
|
else
|
||||||
return TypeProvider::function(*this, FunctionType::Kind::Internal);
|
return TypeProvider::function(*this, FunctionType::Kind::Internal);
|
||||||
}
|
}
|
||||||
@ -375,7 +375,7 @@ FunctionDefinition const& FunctionDefinition::resolveVirtual(
|
|||||||
|
|
||||||
solAssert(!dynamic_cast<ContractDefinition const&>(*scope()).isLibrary(), "");
|
solAssert(!dynamic_cast<ContractDefinition const&>(*scope()).isLibrary(), "");
|
||||||
|
|
||||||
FunctionType const* functionType = TypeProvider::function(*this)->asCallableFunction(false);
|
FunctionType const* functionType = TypeProvider::function(*this)->asExternallyCallableFunction(false);
|
||||||
|
|
||||||
for (ContractDefinition const* c: _mostDerivedContract.annotation().linearizedBaseContracts)
|
for (ContractDefinition const* c: _mostDerivedContract.annotation().linearizedBaseContracts)
|
||||||
{
|
{
|
||||||
@ -386,7 +386,7 @@ FunctionDefinition const& FunctionDefinition::resolveVirtual(
|
|||||||
if (
|
if (
|
||||||
function->name() == name() &&
|
function->name() == name() &&
|
||||||
!function->isConstructor() &&
|
!function->isConstructor() &&
|
||||||
FunctionType(*function).asCallableFunction(false)->hasEqualParameterTypes(*functionType)
|
FunctionType(*function).asExternallyCallableFunction(false)->hasEqualParameterTypes(*functionType)
|
||||||
)
|
)
|
||||||
return *function;
|
return *function;
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@ MemberList::MemberMap Type::boundFunctions(Type const& _type, ContractDefinition
|
|||||||
seenFunctions.insert(function);
|
seenFunctions.insert(function);
|
||||||
if (function->parameters().empty())
|
if (function->parameters().empty())
|
||||||
continue;
|
continue;
|
||||||
FunctionTypePointer fun = FunctionType(*function, FunctionType::Kind::External).asCallableFunction(true, true);
|
FunctionTypePointer fun = FunctionType(*function, FunctionType::Kind::External).asExternallyCallableFunction(true, true);
|
||||||
if (_type.isImplicitlyConvertibleTo(*fun->selfType()))
|
if (_type.isImplicitlyConvertibleTo(*fun->selfType()))
|
||||||
members.emplace_back(function->name(), fun, function);
|
members.emplace_back(function->name(), fun, function);
|
||||||
}
|
}
|
||||||
@ -2058,7 +2058,7 @@ MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const* _con
|
|||||||
for (auto const& it: m_contract.interfaceFunctions())
|
for (auto const& it: m_contract.interfaceFunctions())
|
||||||
members.emplace_back(
|
members.emplace_back(
|
||||||
it.second->declaration().name(),
|
it.second->declaration().name(),
|
||||||
it.second->asCallableFunction(m_contract.isLibrary()),
|
it.second->asExternallyCallableFunction(m_contract.isLibrary()),
|
||||||
&it.second->declaration()
|
&it.second->declaration()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -3427,7 +3427,7 @@ TypePointer FunctionType::copyAndSetCallOptions(bool _setGas, bool _setValue, bo
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionTypePointer FunctionType::asCallableFunction(bool _inLibrary, bool _bound) const
|
FunctionTypePointer FunctionType::asExternallyCallableFunction(bool _inLibrary, bool _bound) const
|
||||||
{
|
{
|
||||||
if (_bound)
|
if (_bound)
|
||||||
solAssert(!m_parameterTypes.empty(), "");
|
solAssert(!m_parameterTypes.empty(), "");
|
||||||
|
@ -1290,11 +1290,11 @@ public:
|
|||||||
|
|
||||||
/// @returns a copy of this function type where the location of reference types is changed
|
/// @returns a copy of this function type where the location of reference types is changed
|
||||||
/// from CallData to Memory. This is the type that would be used when the function is
|
/// from CallData to Memory. This is the type that would be used when the function is
|
||||||
/// called, as opposed to the parameter types that are available inside the function body.
|
/// called externally, as opposed to the parameter types that are available inside the function body.
|
||||||
/// Also supports variants to be used for library or bound calls.
|
/// Also supports variants to be used for library or bound calls.
|
||||||
/// @param _inLibrary if true, uses DelegateCall as location.
|
/// @param _inLibrary if true, uses DelegateCall as location.
|
||||||
/// @param _bound if true, the function type is set to be bound.
|
/// @param _bound if true, the function type is set to be bound.
|
||||||
FunctionTypePointer asCallableFunction(bool _inLibrary, bool _bound = false) const;
|
FunctionTypePointer asExternallyCallableFunction(bool _inLibrary, bool _bound = false) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::tuple<std::string, TypePointer>> makeStackItems() const override;
|
std::vector<std::tuple<std::string, TypePointer>> makeStackItems() const override;
|
||||||
|
@ -74,8 +74,8 @@ bool SMTEncoder::visit(ContractDefinition const& _contract)
|
|||||||
if (
|
if (
|
||||||
function->name() == baseFunction->name() &&
|
function->name() == baseFunction->name() &&
|
||||||
function->kind() == baseFunction->kind() &&
|
function->kind() == baseFunction->kind() &&
|
||||||
FunctionType(*function).asCallableFunction(false)->
|
FunctionType(*function).asExternallyCallableFunction(false)->
|
||||||
hasEqualParameterTypes(*FunctionType(*baseFunction).asCallableFunction(false))
|
hasEqualParameterTypes(*FunctionType(*baseFunction).asExternallyCallableFunction(false))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
overridden = true;
|
overridden = true;
|
||||||
|
@ -139,8 +139,8 @@ void OverridingFunction::endVisit(ContractDefinition const& _contract)
|
|||||||
for (auto [begin, end] = inheritedFunctions.equal_range(proxy); begin != end; begin++)
|
for (auto [begin, end] = inheritedFunctions.equal_range(proxy); begin != end; begin++)
|
||||||
{
|
{
|
||||||
auto& super = (*begin);
|
auto& super = (*begin);
|
||||||
auto functionType = FunctionType(*function).asCallableFunction(false);
|
auto functionType = FunctionType(*function).asExternallyCallableFunction(false);
|
||||||
auto superType = super.functionType()->asCallableFunction(false);
|
auto superType = super.functionType()->asExternallyCallableFunction(false);
|
||||||
|
|
||||||
if (functionType && functionType->hasEqualParameterTypes(*superType))
|
if (functionType && functionType->hasEqualParameterTypes(*superType))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user