diff options
author | Christian <c@ethdev.com> | 2014-11-20 17:19:43 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-11-24 04:04:39 +0800 |
commit | fa987e0a206bba35cfe6e311f8bad1470d9b5d4f (patch) | |
tree | b38d2fd49846c2dadf83ff6b1458f432927a1bab /AST.cpp | |
parent | 735dbe69861d6f80368c057423a13ab1d1a9b557 (diff) | |
download | dexon-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.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -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; } |