compiler/types: correctly generates signature for non-proc types (#10658)

This makes signatures generated for nimsuggest correctly distinguish
template/macro/converter from proc.
This commit is contained in:
alaviss 2019-02-13 14:07:58 +07:00 • committed by Andreas Rumpf
commit 9e754c3b06
2 changed files with 21 additions and 1 deletions

View file

@ -588,7 +588,15 @@ proc typeToString(typ: PType, prefer: TPreferedDesc = preferName): string =
if prefer != preferExported:
result.add("(" & typeToString(t.sons[0]) & ")")
of tyProc:
result = if tfIterator in t.flags: "iterator " else: "proc "
result = if tfIterator in t.flags: "iterator "
elif t.owner != nil:
case t.owner.kind
of skTemplate: "template "
of skMacro: "macro "
of skConverter: "converter "
else: "proc "
else:
"proc "
if tfUnresolved in t.flags: result.add "[*missing parameters*]"
result.add "("
for i in countup(1, sonsLen(t) - 1):