Simplify switch statements by refactoring internal break statements

This commit is contained in:
Alex Beregszaszi 2017-09-25 09:41:04 +01:00
parent 74972f5fa6
commit cb6cdfe780
2 changed files with 24 additions and 24 deletions

View File

@ -596,7 +596,6 @@ void CompilerUtils::convertType(
storeInMemoryDynamic(IntegerType(256));
// stack: mempos datapos
storeStringData(data);
break;
}
else
solAssert(
@ -820,15 +819,16 @@ void CompilerUtils::convertType(
// stack: <address> <function_id>
m_context << Instruction::POP;
break;
}
else
{
// 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)
m_context
<< ((u256(1) << (8 * _targetType.storageBytes())) - 1)
<< Instruction::AND;
}
break;
}

View File

@ -1051,9 +1051,8 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
else
alsoSearchInteger = true;
if (!alsoSearchInteger)
break;
if (alsoSearchInteger)
{
if (member == "balance")
{
utils().convertType(
@ -1071,6 +1070,7 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
);
else
solAssert(false, "Invalid member access to integer");
}
break;
}
case Type::Category::Function: