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

Commit 0a356aa

Browse files
committed
Generation
1 parent 3fa262f commit 0a356aa

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

src/query.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,7 @@ void QueryDatabase::RemoveUsrs(SymbolKind usr_kind,
769769
if (type.symbol_idx)
770770
symbols[type.symbol_idx->id].kind = SymbolKind::Invalid;
771771
type.gen++;
772+
//type.def = QueryType::Def();
772773
type.def = nullopt;
773774
}
774775
break;
@@ -779,6 +780,7 @@ void QueryDatabase::RemoveUsrs(SymbolKind usr_kind,
779780
if (func.symbol_idx)
780781
symbols[func.symbol_idx->id].kind = SymbolKind::Invalid;
781782
func.gen++;
783+
//func.def = QueryFunc::Def();
782784
func.def = nullopt;
783785
}
784786
break;
@@ -789,6 +791,7 @@ void QueryDatabase::RemoveUsrs(SymbolKind usr_kind,
789791
if (var.symbol_idx)
790792
symbols[var.symbol_idx->id].kind = SymbolKind::Invalid;
791793
var.gen++;
794+
//var.def = QueryVar::Def();
792795
var.def = nullopt;
793796
}
794797
break;

src/query.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -478,18 +478,6 @@ struct IdMap {
478478
QueryFuncRef ToQuery(IndexFuncRef ref) const;
479479
QueryLocation ToQuery(IndexFunc::Declaration decl) const;
480480
template <typename I>
481-
optional<typename IndexToQuery<I>::type> ToQuery(optional<I> id) const {
482-
if (!id)
483-
return nullopt;
484-
return ToQuery(*id);
485-
}
486-
template <typename I>
487-
optional<WithGen<typename IndexToQuery<I>::type>> ToQuery(optional<I> id, int) const {
488-
if (!id)
489-
return nullopt;
490-
return ToQuery(*id, 0);
491-
}
492-
template <typename I>
493481
Maybe<typename IndexToQuery<I>::type> ToQuery(Maybe<I> id) const {
494482
if (!id)
495483
return nullopt;

src/query_utils.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ template <typename Q>
7777
void EachWithGen(std::vector<Q>& collection, WithGen<Id<Q>> x, std::function<void(Q&)> fn) {
7878
Q& obj = collection[x.value.id];
7979
// FIXME Deprecate optional<Def> def
80-
if (obj.gen == x.gen && obj.def)
80+
// if (obj.gen == x.gen && obj.def)
81+
if (obj.def)
8182
fn(obj);
8283
}
8384

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

0 commit comments

Comments
 (0)