MCPcopy Create free account
hub / github.com/argotorg/solidity / isExplicitlyConvertibleTo

Method isExplicitlyConvertibleTo

libsolidity/ast/Types.cpp:495–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

493}
494
495BoolResult AddressType::isExplicitlyConvertibleTo(Type const& _convertTo) const
496{
497 if ((_convertTo.category() == category()) || isImplicitlyConvertibleTo(_convertTo))
498 return true;
499 else if (auto const* contractType = dynamic_cast<ContractType const*>(&_convertTo))
500 return (m_stateMutability >= StateMutability::Payable) || !contractType->isPayable();
501 else if (m_stateMutability == StateMutability::NonPayable)
502 {
503 if (auto integerType = dynamic_cast<IntegerType const*>(&_convertTo))
504 return (!integerType->isSigned() && integerType->numBits() == 160);
505 else if (auto fixedBytesType = dynamic_cast<FixedBytesType const*>(&_convertTo))
506 return (fixedBytesType->numBytes() == 20);
507 }
508
509 return false;
510}
511
512std::string AddressType::toString(bool) const
513{

Calls 12

isSignedFunction · 0.85
numBytesMethod · 0.80
numberOfMembersMethod · 0.80
isByteArrayOrStringMethod · 0.80
isLibraryMethod · 0.80
categoryMethod · 0.45
isPayableMethod · 0.45
isSignedMethod · 0.45
numBitsMethod · 0.45
stateMutabilityMethod · 0.45
locationMethod · 0.45
kindMethod · 0.45

Tested by

no test coverage detected