summary refs log tree commit diff stats
path: root/compiler/sempass2.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-04-03 16:35:41 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-04-03 16:35:41 +0200
commit08f5087d2c4f96ca6b82c1feed2f25c4e1f9f9b6 (patch)
treed0c47ee3def4dc46fd6f0138b746ff73fbf5baeb /compiler/sempass2.nim
parente8cfa1435408bc4c5ad89908449ab1b39b13f56f (diff)
downloadNim-08f5087d2c4f96ca6b82c1feed2f25c4e1f9f9b6.tar.gz
remove the need for the .procvar annotation
Diffstat (limited to 'compiler/sempass2.nim')
-rw-r--r--compiler/sempass2.nim9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim
index 8193a3537..86e569d7a 100644
--- a/compiler/sempass2.nim
+++ b/compiler/sempass2.nim
@@ -514,8 +514,17 @@ proc propagateEffects(tracked: PEffects, n: PNode, s: PSym) =
     markSideEffect(tracked, s)
   mergeLockLevels(tracked, n, s.getLockLevel)
 
+proc procVarcheck(n: PNode) =
+  if n.kind in nkSymChoices:
+    for x in n: procVarCheck(x)
+  elif n.kind == nkSym and n.sym.magic != mNone:
+    localError(n.info, errXCannotBePassedToProcVar, n.sym.name.s)
+
 proc notNilCheck(tracked: PEffects, n: PNode, paramType: PType) =
   let n = n.skipConv
+  procVarcheck skipConvAndClosure(n)
+  #elif n.kind in nkSymChoices:
+  #  echo "came here"
   if paramType != nil and tfNotNil in paramType.flags and
       n.typ != nil and tfNotNil notin n.typ.flags:
     if n.kind == nkAddr: