mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-12 11:48:01 +00:00
Simplify GetDefinitionSpellingOfSymbol
This commit is contained in:
parent
273b670c0d
commit
a1e1d115bf
@ -216,8 +216,8 @@ struct TextDocumentCodeLensHandler
|
|||||||
|
|
||||||
// "Base"
|
// "Base"
|
||||||
if (func.def->base.size() == 1) {
|
if (func.def->base.size() == 1) {
|
||||||
Maybe<Use> base_loc =
|
Maybe<Use> base_loc = GetDefinitionSpellingOfSymbol(
|
||||||
GetDefinitionSpellingOfSymbol(db, func.def->base[0]);
|
db, SymbolIdx{func.def->base[0], SymbolKind::Func});
|
||||||
if (base_loc) {
|
if (base_loc) {
|
||||||
optional<lsLocation> ls_base =
|
optional<lsLocation> ls_base =
|
||||||
GetLsLocation(db, working_files, *base_loc);
|
GetLsLocation(db, working_files, *base_loc);
|
||||||
|
@ -18,14 +18,6 @@ int ComputeRangeSize(const Range& range) {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Maybe<Use> GetDefinitionSpellingOfSymbol(QueryDatabase* db,
|
|
||||||
QueryFuncId id) {
|
|
||||||
QueryFunc& func = db->funcs[id.id];
|
|
||||||
if (func.def)
|
|
||||||
return func.def->spell;
|
|
||||||
return nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
Maybe<Use> GetDefinitionSpellingOfSymbol(QueryDatabase* db,
|
Maybe<Use> GetDefinitionSpellingOfSymbol(QueryDatabase* db,
|
||||||
SymbolIdx sym) {
|
SymbolIdx sym) {
|
||||||
switch (sym.kind) {
|
switch (sym.kind) {
|
||||||
@ -48,11 +40,11 @@ Maybe<Use> GetDefinitionSpellingOfSymbol(QueryDatabase* db,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SymbolKind::File:
|
case SymbolKind::File:
|
||||||
case SymbolKind::Invalid: {
|
break;
|
||||||
|
case SymbolKind::Invalid:
|
||||||
assert(false && "unexpected");
|
assert(false && "unexpected");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nullopt;
|
return nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
#include <optional.h>
|
#include <optional.h>
|
||||||
|
|
||||||
Maybe<Use> GetDefinitionSpellingOfSymbol(QueryDatabase* db,
|
|
||||||
QueryFuncId id);
|
|
||||||
Maybe<Use> GetDefinitionSpellingOfSymbol(QueryDatabase* db,
|
Maybe<Use> GetDefinitionSpellingOfSymbol(QueryDatabase* db,
|
||||||
SymbolIdx sym);
|
SymbolIdx sym);
|
||||||
Maybe<Use> GetDefinitionExtentOfSymbol(QueryDatabase* db, SymbolIdx sym);
|
Maybe<Use> GetDefinitionExtentOfSymbol(QueryDatabase* db, SymbolIdx sym);
|
||||||
|
Loading…
Reference in New Issue
Block a user