added types.isFinal helper proc

This commit is contained in:
Andreas Rumpf 2019-03-14 07:24:07 +01:00
commit 1f61498238

View file

@ -339,6 +339,10 @@ proc canFormAcycleAux(marker: var IntSet, typ: PType, startId: int): bool =
of tyProc: result = typ.callConv == ccClosure of tyProc: result = typ.callConv == ccClosure
else: discard 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 = proc canFormAcycle*(typ: PType): bool =
var marker = initIntSet() var marker = initIntSet()
result = canFormAcycleAux(marker, typ, typ.id) result = canFormAcycleAux(marker, typ, typ.id)