From c944976d00de84d9cbe8e3e2388a21f0a323444c Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 14 Feb 2015 03:06:50 +0100 Subject: Some changes to enums. --- ExpressionCompiler.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'ExpressionCompiler.cpp') diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp index 63324fe5..29ec3d57 100644 --- a/ExpressionCompiler.cpp +++ b/ExpressionCompiler.cpp @@ -498,12 +498,10 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess) case Type::Category::TypeType: { TypeType const& type = dynamic_cast(*_memberAccess.getExpression().getType()); - ContractType const* contractType; - EnumType const* enumType; if (!type.getMembers().getMemberType(member)) - BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Invalid member access to " + type.toString())); + BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Invalid member access to " + type.toString())); - if ((contractType = dynamic_cast(type.getActualType().get()))) + if (auto contractType = dynamic_cast(type.getActualType().get())) { ContractDefinition const& contract = contractType->getContractDefinition(); for (ASTPointer const& function: contract.getDefinedFunctions()) @@ -513,12 +511,9 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess) return; } } - else if ((enumType = dynamic_cast(type.getActualType().get()))) - { + else if (auto enumType = dynamic_cast(type.getActualType().get())) m_context << enumType->getMemberValue(_memberAccess.getMemberName()); - return; - } - + break; } case Type::Category::ByteArray: { -- cgit v1.2.3