summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-03-29 16:41:05 +0100
committerAraq <rumpf_a@web.de>2013-03-29 16:41:05 +0100
commit2f826b5305d27a5deb004bc91f52640d89c2f603 (patch)
tree7051ca500d6aae082e188417e1a3f83cf3eae3d5 /compiler
parente24305f1e15f63256528e0a9649464919eae83c6 (diff)
downloadNim-2f826b5305d27a5deb004bc91f52640d89c2f603.tar.gz
fixes memory leaks concerning closures
Diffstat (limited to 'compiler')
-rw-r--r--compiler/types.nim5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/types.nim b/compiler/types.nim
index fe8e03c07..0bd7e2679 100644
--- a/compiler/types.nim
+++ b/compiler/types.nim
@@ -346,11 +346,10 @@ proc canFormAcycleAux(marker: var TIntSet, typ: PType, startId: int): bool =
     #if t.kind == tyObject and tfFinal notin t.flags:
     #  # damn inheritance may introduce cycles:
     #  result = true
+  of tyProc: result = typ.callConv == ccClosure
   else: nil
 
-proc canFormAcycle(typ: PType): bool = 
-  # XXX as I expect cycles introduced by closures are very rare, we pretend 
-  # they can't happen here.
+proc canFormAcycle(typ: PType): bool =
   var marker = InitIntSet()
   result = canFormAcycleAux(marker, typ, typ.id)