summary refs log tree commit diff stats
path: root/compiler/suggest.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-08-23 11:30:55 +0200
committerAraq <rumpf_a@web.de>2018-08-23 11:30:55 +0200
commit30597e643fe8818ef1bb6cc93a5c573f92a28ea9 (patch)
treeea6de7aabdbfc5db583e2dfbaf9f792c8240a63e /compiler/suggest.nim
parentcb9e9297fba72c812913376311ca4b7ebd7e007f (diff)
parent55a86497491586dc1b5ad2f6303d53992b999ab5 (diff)
downloadNim-30597e643fe8818ef1bb6cc93a5c573f92a28ea9.tar.gz
fixes merge conflict
Diffstat (limited to 'compiler/suggest.nim')
-rw-r--r--compiler/suggest.nim23
1 files changed, 16 insertions, 7 deletions
diff --git a/compiler/suggest.nim b/compiler/suggest.nim
index 3d3cd2484..770bf25e6 100644
--- a/compiler/suggest.nim
+++ b/compiler/suggest.nim
@@ -454,14 +454,23 @@ proc suggestSym*(conf: ConfigRef; info: TLineInfo; s: PSym; usageSym: var PSym;
       suggestResult(conf, symToSuggest(conf, s, isLocal=false, ideOutline, info, 100, PrefixMatch.None, false, 0))
 
 proc warnAboutDeprecated(conf: ConfigRef; info: TLineInfo; s: PSym) =
+  var pragmaNode: PNode
+
   if s.kind in routineKinds:
-    let n = s.ast[pragmasPos]
-    if n.kind != nkEmpty:
-      for it in n:
-        if whichPragma(it) == wDeprecated and it.safeLen == 2 and
-            it[1].kind in {nkStrLit..nkTripleStrLit}:
-          message(conf, info, warnDeprecated, it[1].strVal & "; " & s.name.s)
-          return
+    pragmaNode = s.ast[pragmasPos]
+  elif s.kind in {skType}:
+    # s.ast = nkTypedef / nkPragmaExpr / [nkSym, nkPragma]
+    pragmaNode = s.ast[0][1]
+
+  doAssert pragmaNode == nil or pragmaNode.kind == nkPragma
+
+  if pragmaNode != nil:
+    for it in pragmaNode:
+      if whichPragma(it) == wDeprecated and it.safeLen == 2 and
+        it[1].kind in {nkStrLit..nkTripleStrLit}:
+        message(conf, info, warnDeprecated, it[1].strVal & "; " & s.name.s)
+        return
+
   message(conf, info, warnDeprecated, s.name.s)
 
 proc markUsed(conf: ConfigRef; info: TLineInfo; s: PSym; usageSym: var PSym) =