Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Commit

Permalink
Generation
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed Feb 4, 2018
1 parent 3fa262f commit 0a356aa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
3 changes: 3 additions & 0 deletions src/query.cc
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ void QueryDatabase::RemoveUsrs(SymbolKind usr_kind,
if (type.symbol_idx)
symbols[type.symbol_idx->id].kind = SymbolKind::Invalid;
type.gen++;
//type.def = QueryType::Def();
type.def = nullopt;
}
break;
Expand All @@ -779,6 +780,7 @@ void QueryDatabase::RemoveUsrs(SymbolKind usr_kind,
if (func.symbol_idx)
symbols[func.symbol_idx->id].kind = SymbolKind::Invalid;
func.gen++;
//func.def = QueryFunc::Def();
func.def = nullopt;
}
break;
Expand All @@ -789,6 +791,7 @@ void QueryDatabase::RemoveUsrs(SymbolKind usr_kind,
if (var.symbol_idx)
symbols[var.symbol_idx->id].kind = SymbolKind::Invalid;
var.gen++;
//var.def = QueryVar::Def();
var.def = nullopt;
}
break;
Expand Down
12 changes: 0 additions & 12 deletions src/query.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,18 +478,6 @@ struct IdMap {
QueryFuncRef ToQuery(IndexFuncRef ref) const;
QueryLocation ToQuery(IndexFunc::Declaration decl) const;
template <typename I>
optional<typename IndexToQuery<I>::type> ToQuery(optional<I> id) const {
if (!id)
return nullopt;
return ToQuery(*id);
}
template <typename I>
optional<WithGen<typename IndexToQuery<I>::type>> ToQuery(optional<I> id, int) const {
if (!id)
return nullopt;
return ToQuery(*id, 0);
}
template <typename I>
Maybe<typename IndexToQuery<I>::type> ToQuery(Maybe<I> id) const {
if (!id)
return nullopt;
Expand Down
5 changes: 3 additions & 2 deletions src/query_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ template <typename Q>
void EachWithGen(std::vector<Q>& collection, WithGen<Id<Q>> x, std::function<void(Q&)> fn) {
Q& obj = collection[x.value.id];
// FIXME Deprecate optional<Def> def
if (obj.gen == x.gen && obj.def)
// if (obj.gen == x.gen && obj.def)
if (obj.def)
fn(obj);
}

Expand All @@ -86,7 +87,7 @@ void EachWithGen(std::vector<Q>& collection, std::vector<WithGen<Id<Q>>>& ids, s
size_t j = 0;
for (WithGen<Id<Q>> x : ids) {
Q& obj = collection[x.value.id];
if (obj.gen == x.gen) {
if (1 /*obj.gen == x.gen*/) {
if (obj.def) // FIXME Deprecate optional<Def> def
fn(obj);
ids[j++] = x;
Expand Down

0 comments on commit 0a356aa

Please sign in to comment.