aboutsummaryrefslogtreecommitdiffstats
path: root/ExpressionCompiler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r--ExpressionCompiler.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp
index dd41b485..4e72aca5 100644
--- a/ExpressionCompiler.cpp
+++ b/ExpressionCompiler.cpp
@@ -494,20 +494,31 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess)
EnumType const& type = dynamic_cast<EnumType const&>(*_memberAccess.getExpression().getType());
EnumDefinition const& enumDef = type.getEnumDefinition();
m_context << enumDef.getMemberValue(_memberAccess.getMemberName());
+ break;
}
case Type::Category::TypeType:
{
TypeType const& type = dynamic_cast<TypeType const&>(*_memberAccess.getExpression().getType());
+ ContractType const* contractType;
+ EnumType const* enumType;
if (type.getMembers().getMemberType(member))
{
- ContractDefinition const& contract = dynamic_cast<ContractType const&>(*type.getActualType())
- .getContractDefinition();
- for (ASTPointer<FunctionDefinition> const& function: contract.getDefinedFunctions())
- if (function->getName() == member)
- {
- m_context << m_context.getFunctionEntryLabel(*function).pushTag();
- return;
- }
+ if ((contractType = dynamic_cast<ContractType const*>(type.getActualType().get())))
+ {
+ ContractDefinition const& contract = contractType->getContractDefinition();
+ for (ASTPointer<FunctionDefinition> const& function: contract.getDefinedFunctions())
+ if (function->getName() == member)
+ {
+ m_context << m_context.getFunctionEntryLabel(*function).pushTag();
+ return;
+ }
+ }
+ else if ((enumType = dynamic_cast<EnumType const*>(type.getActualType().get())))
+ {
+ EnumDefinition const &enumDef = enumType->getEnumDefinition();
+ m_context << enumDef.getMemberValue(_memberAccess.getMemberName());
+ return;
+ }
}
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Invalid member access to " + type.toString()));
}