mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Invalidate cached members if scope changes.
This commit is contained in:
parent
2e4f4e3363
commit
cc2df5f9f2
@ -1787,7 +1787,7 @@ unsigned TypeType::sizeOnStack() const
|
|||||||
MemberList const& TypeType::members(ContractDefinition const* _currentScope) const
|
MemberList const& TypeType::members(ContractDefinition const* _currentScope) const
|
||||||
{
|
{
|
||||||
// We need to lazy-initialize it because of recursive references.
|
// We need to lazy-initialize it because of recursive references.
|
||||||
if (!m_members)
|
if (!m_members || m_cachedScope != _currentScope)
|
||||||
{
|
{
|
||||||
MemberList::MemberMap members;
|
MemberList::MemberMap members;
|
||||||
if (m_actualType->category() == Category::Contract)
|
if (m_actualType->category() == Category::Contract)
|
||||||
@ -1818,6 +1818,7 @@ MemberList const& TypeType::members(ContractDefinition const* _currentScope) con
|
|||||||
members.push_back(MemberList::Member(enumValue->name(), enumType));
|
members.push_back(MemberList::Member(enumValue->name(), enumType));
|
||||||
}
|
}
|
||||||
m_members.reset(new MemberList(members));
|
m_members.reset(new MemberList(members));
|
||||||
|
m_cachedScope = _currentScope;
|
||||||
}
|
}
|
||||||
return *m_members;
|
return *m_members;
|
||||||
}
|
}
|
||||||
|
@ -941,6 +941,7 @@ private:
|
|||||||
TypePointer m_actualType;
|
TypePointer m_actualType;
|
||||||
/// List of member types, will be lazy-initialized because of recursive references.
|
/// List of member types, will be lazy-initialized because of recursive references.
|
||||||
mutable std::unique_ptr<MemberList> m_members;
|
mutable std::unique_ptr<MemberList> m_members;
|
||||||
|
mutable ContractDefinition const* m_cachedScope = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user