From ad1a1f3ee2cb2aad3f1d594dce999ccdd7006aff Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 19 Nov 2014 18:56:10 +0100 Subject: [PATCH] We only care about member types. --- libsolidity/AST.cpp | 2 +- libsolidity/Types.cpp | 8 ++++---- libsolidity/Types.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp index e8bdecf31..2972cb5c2 100644 --- a/libsolidity/AST.cpp +++ b/libsolidity/AST.cpp @@ -469,7 +469,7 @@ void MemberAccess::checkTypeRequirements() unsigned memberIndex = type.memberNameToIndex(*m_memberName); if (memberIndex >= type.getMemberCount()) BOOST_THROW_EXCEPTION(createTypeError("Member \"" + *m_memberName + "\" not found in " + type.toString())); - m_type = type.getMemberByIndex(memberIndex).getType(); + m_type = type.getMemberByIndex(memberIndex); m_isLvalue = true; } diff --git a/libsolidity/Types.cpp b/libsolidity/Types.cpp index e24435976..79d4a1c17 100644 --- a/libsolidity/Types.cpp +++ b/libsolidity/Types.cpp @@ -234,7 +234,7 @@ u256 StructType::getStorageSize() const bool StructType::canLiveOutsideStorage() const { for (unsigned i = 0; i < getMemberCount(); ++i) - if (!getMemberByIndex(i).getType()->canLiveOutsideStorage()) + if (!getMemberByIndex(i)->canLiveOutsideStorage()) return false; return true; } @@ -258,9 +258,9 @@ unsigned StructType::memberNameToIndex(string const& _name) const return unsigned(-1); } -VariableDeclaration const& StructType::getMemberByIndex(unsigned _index) const +shared_ptr const& StructType::getMemberByIndex(unsigned _index) const { - return *m_struct.getMembers()[_index]; + return m_struct.getMembers()[_index].getType(); } u256 StructType::getStorageOffsetOfMember(unsigned _index) const @@ -269,7 +269,7 @@ u256 StructType::getStorageOffsetOfMember(unsigned _index) const u256 offset; // vector> const& members = m_struct.getMembers(); for (unsigned index = 0; index < _index; ++index) - offset += getMemberByIndex(index).getType()->getStorageSize(); + offset += getMemberByIndex(index)->getStorageSize(); return offset; } diff --git a/libsolidity/Types.h b/libsolidity/Types.h index 726470172..b0d95d291 100644 --- a/libsolidity/Types.h +++ b/libsolidity/Types.h @@ -190,7 +190,7 @@ public: unsigned getMemberCount() const; /// Returns the index of the member with name @a _name or unsigned(-1) if it does not exist. unsigned memberNameToIndex(std::string const& _name) const; - VariableDeclaration const& getMemberByIndex(unsigned _index) const; + std::shared_ptr const& getMemberByIndex(unsigned _index) const; u256 getStorageOffsetOfMember(unsigned _index) const; private: