mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Only capture function type to address conversion
This commit is contained in:
parent
0b61f13c7f
commit
4361797ddc
@ -789,15 +789,17 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp
|
|||||||
break;
|
break;
|
||||||
case Type::Category::Function:
|
case Type::Category::Function:
|
||||||
{
|
{
|
||||||
solAssert(targetTypeCategory == Type::Category::Integer, "Invalid conversion for function type.");
|
if (targetTypeCategory == Type::Category::Integer)
|
||||||
IntegerType const& targetType = dynamic_cast<IntegerType const&>(_targetType);
|
{
|
||||||
solAssert(targetType.isAddress(), "Function type can only be converted to address.");
|
IntegerType const& targetType = dynamic_cast<IntegerType const&>(_targetType);
|
||||||
FunctionType const& typeOnStack = dynamic_cast<FunctionType const&>(_typeOnStack);
|
solAssert(targetType.isAddress(), "Function type can only be converted to address.");
|
||||||
solAssert(typeOnStack.location() == FunctionType::Location::External, "Only external function type can be converted.");
|
FunctionType const& typeOnStack = dynamic_cast<FunctionType const&>(_typeOnStack);
|
||||||
|
solAssert(typeOnStack.location() == FunctionType::Location::External, "Only external function type can be converted.");
|
||||||
|
|
||||||
// stack: <address> <function_id>
|
// stack: <address> <function_id>
|
||||||
m_context << Instruction::POP;
|
m_context << Instruction::POP;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
// All other types should not be convertible to non-equal types.
|
// All other types should not be convertible to non-equal types.
|
||||||
|
Loading…
Reference in New Issue
Block a user