mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 15:18:20 +00:00
minor simplifications in using type names, and unordered sets rather than vectors
This commit is contained in:
parent
8f4b616d65
commit
e531b2a7ca
2 changed files with 7 additions and 14 deletions
|
@ -583,7 +583,7 @@ broker::expected<broker::data> Frame::SerializeIDList(const IDPList& in)
|
|||
}
|
||||
|
||||
broker::expected<broker::data>
|
||||
Frame::SerializeOffsetMap(const std::unordered_map<std::string, int>& in)
|
||||
Frame::SerializeOffsetMap(const OffsetMap& in)
|
||||
{
|
||||
broker::vector rval;
|
||||
|
||||
|
@ -638,7 +638,7 @@ Frame::UnserializeIDList(const broker::vector& data)
|
|||
std::pair<bool, std::unordered_map<std::string, int>>
|
||||
Frame::UnserializeOffsetMap(const broker::vector& data)
|
||||
{
|
||||
std::unordered_map<std::string, int> rval;
|
||||
OffsetMap rval;
|
||||
|
||||
for ( broker::vector::size_type i = 0; i < data.size(); i += 2 )
|
||||
{
|
||||
|
|
17
src/Var.cc
17
src/Var.cc
|
@ -679,7 +679,7 @@ public:
|
|||
TraversalCode PostExpr(const Expr*) override;
|
||||
|
||||
std::vector<Scope*> scopes;
|
||||
std::vector<const NameExpr*> outer_id_references;
|
||||
std::unordered_set<const NameExpr*> outer_id_references;
|
||||
};
|
||||
|
||||
TraversalCode OuterIDBindingFinder::PreExpr(const Expr* expr)
|
||||
|
@ -705,7 +705,7 @@ TraversalCode OuterIDBindingFinder::PreExpr(const Expr* expr)
|
|||
// not something we have to worry about also being at outer scope.
|
||||
return TC_CONTINUE;
|
||||
|
||||
outer_id_references.push_back(e);
|
||||
outer_id_references.insert(e);
|
||||
return TC_CONTINUE;
|
||||
}
|
||||
|
||||
|
@ -752,17 +752,10 @@ IDPList gather_outer_ids(Scope* scope, Stmt* body)
|
|||
OuterIDBindingFinder cb(scope);
|
||||
body->Traverse(&cb);
|
||||
|
||||
IDPList idl ( cb.outer_id_references.size() );
|
||||
IDPList idl;
|
||||
|
||||
for ( size_t i = 0; i < cb.outer_id_references.size(); ++i )
|
||||
{
|
||||
auto id = cb.outer_id_references[i]->Id();
|
||||
|
||||
if ( idl.is_member(id) )
|
||||
continue;
|
||||
|
||||
idl.append(id);
|
||||
}
|
||||
for ( auto ne : cb.outer_id_references )
|
||||
idl.append(ne->Id());
|
||||
|
||||
return idl;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue