aboutsummaryrefslogtreecommitdiffstats
path: root/AST.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-11-20 17:19:43 +0800
committerChristian <c@ethdev.com>2014-11-24 04:04:39 +0800
commitfa987e0a206bba35cfe6e311f8bad1470d9b5d4f (patch)
treeb38d2fd49846c2dadf83ff6b1458f432927a1bab /AST.cpp
parent735dbe69861d6f80368c057423a13ab1d1a9b557 (diff)
downloaddexon-solidity-fa987e0a206bba35cfe6e311f8bad1470d9b5d4f.tar.gz
dexon-solidity-fa987e0a206bba35cfe6e311f8bad1470d9b5d4f.tar.zst
dexon-solidity-fa987e0a206bba35cfe6e311f8bad1470d9b5d4f.zip
Convenience class for type members.
Diffstat (limited to 'AST.cpp')
-rw-r--r--AST.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/AST.cpp b/AST.cpp
index 2972cb5c..9aecbded 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -462,14 +462,10 @@ void MemberAccess::checkTypeRequirements()
{
m_expression->checkTypeRequirements();
m_expression->requireLValue();
- if (m_expression->getType()->getCategory() != Type::Category::STRUCT)
- BOOST_THROW_EXCEPTION(createTypeError("Member access to a non-struct (is " +
- m_expression->getType()->toString() + ")"));
- StructType const& type = dynamic_cast<StructType const&>(*m_expression->getType());
- unsigned memberIndex = type.memberNameToIndex(*m_memberName);
- if (memberIndex >= type.getMemberCount())
+ Type const& type = *m_expression->getType();
+ m_type = type.getMemberType(*m_memberName);
+ if (!m_type)
BOOST_THROW_EXCEPTION(createTypeError("Member \"" + *m_memberName + "\" not found in " + type.toString()));
- m_type = type.getMemberByIndex(memberIndex);
m_isLvalue = true;
}