mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-25 09:05:10 +00:00
memberHierarchy
This commit is contained in:
parent
c166f3bca8
commit
42825d022b
@ -107,24 +107,40 @@ bool Expand(MessageHandler* m,
|
|||||||
else
|
else
|
||||||
entry->name = def->ShortName();
|
entry->name = def->ShortName();
|
||||||
if (levels > 0) {
|
if (levels > 0) {
|
||||||
EachDefinedEntity(m->db->vars, def->vars, [&](QueryVar& var) {
|
std::unordered_set<Usr> seen;
|
||||||
const QueryVar::Def* def1 = var.AnyDef();
|
std::vector<const QueryType*> stack;
|
||||||
if (!def1)
|
seen.insert(type.usr);
|
||||||
return;
|
stack.push_back(&type);
|
||||||
Out_CqueryMemberHierarchy::Entry entry1;
|
while (stack.size()) {
|
||||||
entry1.id = def1->type ? *def1->type : QueryTypeId();
|
const QueryType& type = *stack.back();
|
||||||
if (detailed_name)
|
stack.pop_back();
|
||||||
entry1.fieldName = def1->DetailedName(false);
|
if (const auto* def = type.AnyDef()) {
|
||||||
else
|
EachDefinedEntity(m->db->types, def->bases, [&](QueryType& type1) {
|
||||||
entry1.fieldName = std::string(def1->ShortName());
|
if (!seen.count(type1.usr)) {
|
||||||
if (def1->spell) {
|
seen.insert(type1.usr);
|
||||||
if (optional<lsLocation> loc =
|
stack.push_back(&type1);
|
||||||
GetLsLocation(m->db, m->working_files, *def1->spell))
|
}
|
||||||
entry1.location = *loc;
|
});
|
||||||
|
EachDefinedEntity(m->db->vars, def->vars, [&](QueryVar& var) {
|
||||||
|
const QueryVar::Def* def1 = var.AnyDef();
|
||||||
|
if (!def1)
|
||||||
|
return;
|
||||||
|
Out_CqueryMemberHierarchy::Entry entry1;
|
||||||
|
entry1.id = def1->type ? *def1->type : QueryTypeId();
|
||||||
|
if (detailed_name)
|
||||||
|
entry1.fieldName = def1->DetailedName(false);
|
||||||
|
else
|
||||||
|
entry1.fieldName = std::string(def1->ShortName());
|
||||||
|
if (def1->spell) {
|
||||||
|
if (optional<lsLocation> loc =
|
||||||
|
GetLsLocation(m->db, m->working_files, *def1->spell))
|
||||||
|
entry1.location = *loc;
|
||||||
|
}
|
||||||
|
if (def1->type && Expand(m, &entry1, detailed_name, levels - 1))
|
||||||
|
entry->children.push_back(std::move(entry1));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (Expand(m, &entry1, detailed_name, levels - 1))
|
}
|
||||||
entry->children.push_back(std::move(entry1));
|
|
||||||
});
|
|
||||||
entry->numChildren = int(entry->children.size());
|
entry->numChildren = int(entry->children.size());
|
||||||
} else
|
} else
|
||||||
entry->numChildren = int(def->vars.size());
|
entry->numChildren = int(def->vars.size());
|
||||||
|
Loading…
Reference in New Issue
Block a user