From cb6cdfe7801a3362a489d0fd39cc0ce5a7075fea Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 25 Sep 2017 09:41:04 +0100 Subject: Simplify switch statements by refactoring internal break statements --- libsolidity/codegen/ExpressionCompiler.cpp | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'libsolidity/codegen/ExpressionCompiler.cpp') diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 63d7f1e6..b286594a 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -1051,26 +1051,26 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess) else alsoSearchInteger = true; - if (!alsoSearchInteger) - break; - - if (member == "balance") + if (alsoSearchInteger) { - utils().convertType( - *_memberAccess.expression().annotation().type, - IntegerType(0, IntegerType::Modifier::Address), - true - ); - m_context << Instruction::BALANCE; + if (member == "balance") + { + utils().convertType( + *_memberAccess.expression().annotation().type, + IntegerType(0, IntegerType::Modifier::Address), + true + ); + m_context << Instruction::BALANCE; + } + else if ((set{"send", "transfer", "call", "callcode", "delegatecall"}).count(member)) + utils().convertType( + *_memberAccess.expression().annotation().type, + IntegerType(0, IntegerType::Modifier::Address), + true + ); + else + solAssert(false, "Invalid member access to integer"); } - else if ((set{"send", "transfer", "call", "callcode", "delegatecall"}).count(member)) - utils().convertType( - *_memberAccess.expression().annotation().type, - IntegerType(0, IntegerType::Modifier::Address), - true - ); - else - solAssert(false, "Invalid member access to integer"); break; } case Type::Category::Function: -- cgit