From 1f614982389da147876722bf66c238c82b55d1c2 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Thu, 14 Mar 2019 07:24:07 +0100 Subject: added types.isFinal helper proc --- compiler/types.nim | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'compiler') 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) -- cgit 1.4.1-2-gfad0