hide private functions

This commit is contained in:
davu 2022-10-08 15:45:49 +02:00 committed by Jan Jurzitza
parent 98d09a2fe5
commit 951870e06f
2 changed files with 11 additions and 3 deletions

View File

@ -69,6 +69,8 @@ DSymbol*[] getSymbolsForUFCS(Scope* completionScope, const(DSymbol)* beforeDotSy
HashSet!size_t visited;
// local imports only
FilteredAppender!(a => a.isCallableWithArg(beforeDotSymbol), DSymbol*[]) app;
FilteredAppender!(a => a.protection != tok!"private", DSymbol*[]) globalsFunctions;
while (currentScope !is null && currentScope.parent !is null)
{
auto localImports = currentScope.symbols.filter!(a => a.kind == CompletionKind.importSymbol);
@ -95,8 +97,12 @@ DSymbol*[] getSymbolsForUFCS(Scope* completionScope, const(DSymbol)* beforeDotSy
{
if (sym.qualifier == SymbolQualifier.selectiveImport)
app.put(sym.type);
else
sym.type.getParts(internString(null), app, visited);
else{
sym.type.getParts(istring(null), globalsFunctions, visited);
foreach(gSym; globalsFunctions) {
app.put(gSym);
}
}
}
}
return app.data;

View File

@ -25,4 +25,6 @@ void ufcsBarRefConst(ref const Foo foo, string mama)
void ufcsBarRefConstWrapped(ref const(Foo) foo, string mama) {}
void ufcsBarRefImmuttableWrapped(ref immutable(Foo) foo, string mama) {}
void ufcsBarScope(ref scope Foo foo, string mama) {}
void ufcsBarReturnScope(return scope Foo foo, string mama) {}
void ufcsBarReturnScope(return scope Foo foo, string mama) {}
private void privateUfcsBar(Foo foo, string message) {}
void notUfcsBar(string message) {}