Skip to content

Commit

Permalink
Update libsolidity/interface/Natspec.cpp
Browse files Browse the repository at this point in the history
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
  • Loading branch information
matheusaaguiar and cameel authored Apr 29, 2023
1 parent 2750919 commit d0bf624
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions libsolidity/interface/Natspec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,15 +275,13 @@ vector<EventDefinition const*> Natspec::uniqueInterfaceEvents(ContractDefinitio

set<EventDefinition const*, decltype(compareBySignature)> filteredUsedEvents{compareBySignature};
set<string> usedSignatures;
pair<set<string>::iterator, bool> signatureResult;
pair<set<EventDefinition const*, decltype(compareBySignature)>::iterator, bool> eventResult;
for (EventDefinition const* event: _contract.usedInterfaceEvents())
{
eventResult = filteredUsedEvents.insert(event);
signatureResult = usedSignatures.insert(eventSignature(event));
if (signatureResult.second == false)
auto&& [eventIt, eventInserted] = filteredUsedEvents.insert(event);
auto&& [signatureIt, signatureInserted] = usedSignatures.insert(eventSignature(event));
if (!signatureInserted)
// Either the old event or the new one will be erased
filteredUsedEvents.erase(eventResult.first);
filteredUsedEvents.erase(eventIt);
}

uniqueEvents += filteredUsedEvents;
Expand Down

0 comments on commit d0bf624

Please sign in to comment.