store the type name into its own field, so we could resolve templates later

This commit is contained in:
ryuukk 2023-02-01 19:57:27 +01:00
parent 674f72750a
commit 7822f78056
3 changed files with 12 additions and 7 deletions

View File

@ -64,13 +64,14 @@ ScopeSymbolPair generateAutocompleteTrees(const(Token)[] tokens,
visited.insert(cast(size_t) part);
// no type but a callTip, let's resolve its type
if (part.type is null && part.callTip !is null)
if (part.type is null && part.typeSymbolName !is null)
{
auto typeName = part.callTip;
import std.string: indexOf;
auto typeName = part.typeSymbolName;
// check if it is available in the scope
// otherwise grab its module symbol to check if it's publickly available
auto result = sc.getSymbolsAtGlobalScope(typeName);
auto result = sc.getSymbolsAtGlobalScope(istring(typeName));
if (result.length > 0)
{
part.type = result[0];
@ -80,7 +81,7 @@ ScopeSymbolPair generateAutocompleteTrees(const(Token)[] tokens,
{
if (part.symbolFile == "stdin") return;
auto moduleSymbol = cache.getModuleSymbol(part.symbolFile);
auto first = moduleSymbol.getFirstPartNamed(typeName);
auto first = moduleSymbol.getFirstPartNamed(istring(typeName));
if (first !is null)
{
part.type = first;

View File

@ -246,9 +246,8 @@ do
currentSymbol = symbols[0];
else
{
// store the callTip, that'll be useful to resolve the type later
if (symbol.callTip is null)
symbol.callTip = istring(part);
// store the part, that'll be useful to resolve the type later
symbol.typeSymbolName = istring(part);
return;
}
}

View File

@ -386,6 +386,11 @@ struct DSymbol
*/
DSymbol*[] functionParameters;
/**
* Used to resolve the type
*/
istring typeSymbolName;
private uint _location;
/**