diff options
author | Nikolay Nikolov <nickysn@gmail.com> | 2024-09-09 12:45:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-09 11:45:22 +0200 |
commit | 09682ac7f10230a9542f7a5e9edb5c5e5db32fc6 (patch) | |
tree | e9cc864a72dbde1a51188deb07738dc05475fd79 /compiler | |
parent | a6595e5b49ffa94947a2e5767263f523cd827c44 (diff) | |
download | Nim-09682ac7f10230a9542f7a5e9edb5c5e5db32fc6.tar.gz |
+ show the effectsOf pragma (if present) of procs in nimsuggest hints… (#23305)
… and compiler messages
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/types.nim | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/types.nim b/compiler/types.nim index cdb77bfe8..2333672d2 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -748,6 +748,16 @@ proc typeToString(typ: PType, prefer: TPreferedDesc = preferName): string = if tfThread in t.flags: addSep(prag) prag.add("gcsafe") + var effectsOfStr = "" + for i, a in t.paramTypes: + let j = paramTypeToNodeIndex(i) + if t.n != nil and j < t.n.len and t.n[j].kind == nkSym and t.n[j].sym.kind == skParam and sfEffectsDelayed in t.n[j].sym.flags: + addSep(effectsOfStr) + effectsOfStr.add(t.n[j].sym.name.s) + if effectsOfStr != "": + addSep(prag) + prag.add("effectsOf: ") + prag.add(effectsOfStr) if not hasImplicitRaises and prefer == preferInferredEffects and not isNil(t.owner) and not isNil(t.owner.typ) and not isNil(t.owner.typ.n) and (t.owner.typ.n.len > 0): let effects = t.owner.typ.n[0] if effects.kind == nkEffectList and effects.len == effectListLen: |