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