aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-09-20 02:02:13 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-09-25 17:51:58 +0800
commit3e5d81578a10cfa1afc50c12074c67572499b4fb (patch)
tree414a45fc666dba6d55033c57f3714d47f64d04a3
parentccb689701e6a602a44bf2941ca71c683f96907d1 (diff)
downloaddexon-solidity-3e5d81578a10cfa1afc50c12074c67572499b4fb.tar
dexon-solidity-3e5d81578a10cfa1afc50c12074c67572499b4fb.tar.gz
dexon-solidity-3e5d81578a10cfa1afc50c12074c67572499b4fb.tar.bz2
dexon-solidity-3e5d81578a10cfa1afc50c12074c67572499b4fb.tar.lz
dexon-solidity-3e5d81578a10cfa1afc50c12074c67572499b4fb.tar.xz
dexon-solidity-3e5d81578a10cfa1afc50c12074c67572499b4fb.tar.zst
dexon-solidity-3e5d81578a10cfa1afc50c12074c67572499b4fb.zip
Avoid switch fallthrough in CompilerUtils
-rw-r--r--libsolidity/codegen/CompilerUtils.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp
index 37aa1aea..4d273b87 100644
--- a/libsolidity/codegen/CompilerUtils.cpp
+++ b/libsolidity/codegen/CompilerUtils.cpp
@@ -810,9 +810,8 @@ void CompilerUtils::convertType(
if (_cleanupNeeded)
m_context << Instruction::ISZERO << Instruction::ISZERO;
break;
- case Type::Category::Function:
- {
- if (targetTypeCategory == Type::Category::Integer)
+ default:
+ if (stackTypeCategory == Type::Category::Function && targetTypeCategory == Type::Category::Integer)
{
IntegerType const& targetType = dynamic_cast<IntegerType const&>(_targetType);
solAssert(targetType.isAddress(), "Function type can only be converted to address.");
@@ -823,9 +822,7 @@ void CompilerUtils::convertType(
m_context << Instruction::POP;
break;
}
- }
- // fall-through
- default:
+
// All other types should not be convertible to non-equal types.
solAssert(_typeOnStack == _targetType, "Invalid type conversion requested.");
if (_cleanupNeeded && _targetType.canBeStored() && _targetType.storageBytes() < 32)