aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-02-01 20:22:14 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-02-01 20:23:47 +0800
commit4361797ddca240dc55c9f88c6579383eb558b309 (patch)
treeeb73fbb396c003d6de58aae20ace84954ebc4316 /libsolidity/codegen
parent0b61f13c7f83667c524197fcfd53f04ab7645e1e (diff)
downloaddexon-solidity-4361797ddca240dc55c9f88c6579383eb558b309.tar.gz
dexon-solidity-4361797ddca240dc55c9f88c6579383eb558b309.tar.zst
dexon-solidity-4361797ddca240dc55c9f88c6579383eb558b309.zip
Only capture function type to address conversion
Diffstat (limited to 'libsolidity/codegen')
-rw-r--r--libsolidity/codegen/CompilerUtils.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp
index 469bd0ed..9f019d27 100644
--- a/libsolidity/codegen/CompilerUtils.cpp
+++ b/libsolidity/codegen/CompilerUtils.cpp
@@ -789,15 +789,17 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp
break;
case Type::Category::Function:
{
- solAssert(targetTypeCategory == Type::Category::Integer, "Invalid conversion for function type.");
- IntegerType const& targetType = dynamic_cast<IntegerType const&>(_targetType);
- solAssert(targetType.isAddress(), "Function type can only be converted to address.");
- FunctionType const& typeOnStack = dynamic_cast<FunctionType const&>(_typeOnStack);
- solAssert(typeOnStack.location() == FunctionType::Location::External, "Only external function type can be converted.");
+ if (targetTypeCategory == Type::Category::Integer)
+ {
+ IntegerType const& targetType = dynamic_cast<IntegerType const&>(_targetType);
+ solAssert(targetType.isAddress(), "Function type can only be converted to address.");
+ 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>
- m_context << Instruction::POP;
- break;
+ // stack: <address> <function_id>
+ m_context << Instruction::POP;
+ break;
+ }
}
default:
// All other types should not be convertible to non-equal types.