summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-03-14 07:24:07 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-03-14 07:59:44 +0100
commit1f614982389da147876722bf66c238c82b55d1c2 (patch)
tree22a5135ba51519fad280c8cd7d7316b6cb8becda /compiler
parentee7a9a272dcbcf35c5c844101bb090e031029765 (diff)
downloadNim-1f614982389da147876722bf66c238c82b55d1c2.tar.gz
added types.isFinal helper proc
Diffstat (limited to 'compiler')
-rw-r--r--compiler/types.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/types.nim b/compiler/types.nim
index b71888906..ddd299a86 100644
--- a/compiler/types.nim
+++ b/compiler/types.nim
@@ -339,6 +339,10 @@ proc canFormAcycleAux(marker: var IntSet, typ: PType, startId: int): bool =
   of tyProc: result = typ.callConv == ccClosure
   else: discard
 
+proc isFinal*(t: PType): bool =
+  var t = t.skipTypes(abstractInst)
+  result = t.kind != tyObject or tfFinal in t.flags
+
 proc canFormAcycle*(typ: PType): bool =
   var marker = initIntSet()
   result = canFormAcycleAux(marker, typ, typ.id)