mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Simplify switch statements by refactoring internal break statements
This commit is contained in:
parent
74972f5fa6
commit
cb6cdfe780
@ -596,7 +596,6 @@ void CompilerUtils::convertType(
|
|||||||
storeInMemoryDynamic(IntegerType(256));
|
storeInMemoryDynamic(IntegerType(256));
|
||||||
// stack: mempos datapos
|
// stack: mempos datapos
|
||||||
storeStringData(data);
|
storeStringData(data);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
solAssert(
|
solAssert(
|
||||||
@ -820,15 +819,16 @@ void CompilerUtils::convertType(
|
|||||||
|
|
||||||
// stack: <address> <function_id>
|
// stack: <address> <function_id>
|
||||||
m_context << Instruction::POP;
|
m_context << Instruction::POP;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// All other types should not be convertible to non-equal types.
|
// All other types should not be convertible to non-equal types.
|
||||||
solAssert(_typeOnStack == _targetType, "Invalid type conversion requested.");
|
solAssert(_typeOnStack == _targetType, "Invalid type conversion requested.");
|
||||||
if (_cleanupNeeded && _targetType.canBeStored() && _targetType.storageBytes() < 32)
|
if (_cleanupNeeded && _targetType.canBeStored() && _targetType.storageBytes() < 32)
|
||||||
m_context
|
m_context
|
||||||
<< ((u256(1) << (8 * _targetType.storageBytes())) - 1)
|
<< ((u256(1) << (8 * _targetType.storageBytes())) - 1)
|
||||||
<< Instruction::AND;
|
<< Instruction::AND;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1051,9 +1051,8 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
|
|||||||
else
|
else
|
||||||
alsoSearchInteger = true;
|
alsoSearchInteger = true;
|
||||||
|
|
||||||
if (!alsoSearchInteger)
|
if (alsoSearchInteger)
|
||||||
break;
|
{
|
||||||
|
|
||||||
if (member == "balance")
|
if (member == "balance")
|
||||||
{
|
{
|
||||||
utils().convertType(
|
utils().convertType(
|
||||||
@ -1071,6 +1070,7 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
|
|||||||
);
|
);
|
||||||
else
|
else
|
||||||
solAssert(false, "Invalid member access to integer");
|
solAssert(false, "Invalid member access to integer");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Type::Category::Function:
|
case Type::Category::Function:
|
||||||
|
Loading…
Reference in New Issue
Block a user