mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use LazyInit for ContractDefinition::m_interfaceEvents
This commit is contained in:
parent
0e26700f65
commit
413fa92cee
@ -153,10 +153,10 @@ FunctionDefinition const* ContractDefinition::receiveFunction() const
|
||||
|
||||
vector<EventDefinition const*> const& ContractDefinition::interfaceEvents() const
|
||||
{
|
||||
if (!m_interfaceEvents)
|
||||
{
|
||||
return m_interfaceEvents.init([&]{
|
||||
set<string> eventsSeen;
|
||||
m_interfaceEvents = make_unique<vector<EventDefinition const*>>();
|
||||
vector<EventDefinition const*> interfaceEvents;
|
||||
|
||||
for (ContractDefinition const* contract: annotation().linearizedBaseContracts)
|
||||
for (EventDefinition const* e: contract->events())
|
||||
{
|
||||
@ -169,11 +169,12 @@ vector<EventDefinition const*> const& ContractDefinition::interfaceEvents() cons
|
||||
if (eventsSeen.count(eventSignature) == 0)
|
||||
{
|
||||
eventsSeen.insert(eventSignature);
|
||||
m_interfaceEvents->push_back(e);
|
||||
interfaceEvents.push_back(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return *m_interfaceEvents;
|
||||
|
||||
return interfaceEvents;
|
||||
});
|
||||
}
|
||||
|
||||
vector<pair<util::FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::interfaceFunctionList(bool _includeInheritedFunctions) const
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <liblangutil/SourceLocation.h>
|
||||
#include <libevmasm/Instruction.h>
|
||||
#include <libsolutil/FixedHash.h>
|
||||
#include <libsolutil/LazyInit.h>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <json/json.h>
|
||||
@ -530,7 +531,7 @@ private:
|
||||
bool m_abstract{false};
|
||||
|
||||
mutable std::unique_ptr<std::vector<std::pair<util::FixedHash<4>, FunctionTypePointer>>> m_interfaceFunctionList[2];
|
||||
mutable std::unique_ptr<std::vector<EventDefinition const*>> m_interfaceEvents;
|
||||
util::LazyInit<std::vector<EventDefinition const*>> m_interfaceEvents;
|
||||
};
|
||||
|
||||
class InheritanceSpecifier: public ASTNode
|
||||
|
Loading…
Reference in New Issue
Block a user