mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Rename 'asMemberFunction' to widen its purpose.
This commit is contained in:
parent
dc748bc771
commit
9e964852cc
@ -443,7 +443,7 @@ MemberList::MemberMap Type::boundFunctions(Type const& _type, ContractDefinition
|
|||||||
continue;
|
continue;
|
||||||
seenFunctions.insert(function);
|
seenFunctions.insert(function);
|
||||||
FunctionType funType(*function, false);
|
FunctionType funType(*function, false);
|
||||||
if (auto fun = funType.asMemberFunction(true, true))
|
if (auto fun = funType.asCallableFunction(true, true))
|
||||||
if (_type.isImplicitlyConvertibleTo(*fun->selfType()))
|
if (_type.isImplicitlyConvertibleTo(*fun->selfType()))
|
||||||
members.push_back(MemberList::Member(function->name(), fun, function));
|
members.push_back(MemberList::Member(function->name(), fun, function));
|
||||||
}
|
}
|
||||||
@ -1970,7 +1970,7 @@ MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const* _con
|
|||||||
for (auto const& it: m_contract.interfaceFunctions())
|
for (auto const& it: m_contract.interfaceFunctions())
|
||||||
members.push_back(MemberList::Member(
|
members.push_back(MemberList::Member(
|
||||||
it.second->declaration().name(),
|
it.second->declaration().name(),
|
||||||
it.second->asMemberFunction(m_contract.isLibrary()),
|
it.second->asCallableFunction(m_contract.isLibrary()),
|
||||||
&it.second->declaration()
|
&it.second->declaration()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -3059,7 +3059,7 @@ TypePointer FunctionType::copyAndSetGasOrValue(bool _setGas, bool _setValue) con
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionTypePointer FunctionType::asMemberFunction(bool _inLibrary, bool _bound) const
|
FunctionTypePointer FunctionType::asCallableFunction(bool _inLibrary, bool _bound) const
|
||||||
{
|
{
|
||||||
if (_bound && m_parameterTypes.empty())
|
if (_bound && m_parameterTypes.empty())
|
||||||
return FunctionTypePointer();
|
return FunctionTypePointer();
|
||||||
@ -3201,7 +3201,7 @@ MemberList::MemberMap TypeType::nativeMembers(ContractDefinition const* _current
|
|||||||
if (function->isVisibleAsLibraryMember())
|
if (function->isVisibleAsLibraryMember())
|
||||||
members.push_back(MemberList::Member(
|
members.push_back(MemberList::Member(
|
||||||
function->name(),
|
function->name(),
|
||||||
FunctionType(*function).asMemberFunction(true),
|
FunctionType(*function).asCallableFunction(true),
|
||||||
function
|
function
|
||||||
));
|
));
|
||||||
if (isBase)
|
if (isBase)
|
||||||
|
@ -1154,14 +1154,14 @@ public:
|
|||||||
/// of the parameters to false.
|
/// of the parameters to false.
|
||||||
TypePointer copyAndSetGasOrValue(bool _setGas, bool _setValue) const;
|
TypePointer copyAndSetGasOrValue(bool _setGas, bool _setValue) const;
|
||||||
|
|
||||||
/// @returns a copy of this function type where all return parameters of dynamic size are
|
/// @returns a copy of this function type where the location of reference types is changed
|
||||||
/// removed and the location of reference types is changed from CallData to Memory.
|
/// from CallData to Memory. This is the type that would be used when the function is
|
||||||
/// This is needed if external functions are called on other contracts, as they cannot return
|
/// called, as opposed to the parameter types that are available inside the function body.
|
||||||
/// dynamic values.
|
/// Also supports variants to be used for library or bound calls.
|
||||||
/// Returns empty shared pointer on a failure. Namely, if a bound function has no parameters.
|
/// Returns empty shared pointer on a failure. Namely, if a bound function has no parameters.
|
||||||
/// @param _inLibrary if true, uses DelegateCall as location.
|
/// @param _inLibrary if true, uses DelegateCall as location.
|
||||||
/// @param _bound if true, the arguments are placed as `arg1.functionName(arg2, ..., argn)`.
|
/// @param _bound if true, the arguments are placed as `arg1.functionName(arg2, ..., argn)`.
|
||||||
FunctionTypePointer asMemberFunction(bool _inLibrary, bool _bound = false) const;
|
FunctionTypePointer asCallableFunction(bool _inLibrary, bool _bound = false) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static TypePointers parseElementaryTypeVector(strings const& _types);
|
static TypePointers parseElementaryTypeVector(strings const& _types);
|
||||||
|
Loading…
Reference in New Issue
Block a user