diff options
author | Nikolay Nikolov <nickysn@gmail.com> | 2023-12-04 08:17:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-04 07:17:42 +0100 |
commit | 618ccb6b6a60f9a315997f95cbbd81be9e9d7f53 (patch) | |
tree | 46440438f9fc9ef23646e7deaa5437dbe1d67841 /compiler | |
parent | b8fa78939398397f557dbae1c905800850829e29 (diff) | |
download | Nim-618ccb6b6a60f9a315997f95cbbd81be9e9d7f53.tar.gz |
Also show the `raises` pragma when converting proc types to string (#23026)
This affects also nimsuggest hints (e.g. on mouse hover), as well as compiler messages.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/types.nim | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/types.nim b/compiler/types.nim index 7bb29405f..f10d5aa86 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -11,7 +11,7 @@ import ast, astalgo, trees, msgs, platform, renderer, options, - lineinfos, int128, modulegraphs, astmsgs + lineinfos, int128, modulegraphs, astmsgs, wordrecg import std/[intsets, strutils] @@ -762,6 +762,14 @@ proc typeToString(typ: PType, prefer: TPreferedDesc = preferName): string = result.add(')') if t.len > 0 and t[0] != nil: result.add(": " & typeToString(t[0])) var prag = if t.callConv == ccNimCall and tfExplicitCallConv notin t.flags: "" else: $t.callConv + if not isNil(t.owner) and not isNil(t.owner.ast) and (t.owner.ast.len - 1) >= pragmasPos: + let pragmasNode = t.owner.ast[pragmasPos] + let raisesSpec = effectSpec(pragmasNode, wRaises) + if not isNil(raisesSpec): + addSep(prag) + prag.add("raises: ") + prag.add($raisesSpec) + if tfNoSideEffect in t.flags: addSep(prag) prag.add("noSideEffect") |