further preparations for 'opt' builtin type

This commit is contained in:
Andreas Rumpf 2017-10-09 20:43:58 +02:00
commit 6e337fe58a

View file

@ -1400,7 +1400,7 @@ proc isGCedMem*(t: PType): bool {.inline.} =
t.kind == tyProc and t.callConv == ccClosure t.kind == tyProc and t.callConv == ccClosure
proc propagateToOwner*(owner, elem: PType) = proc propagateToOwner*(owner, elem: PType) =
const HaveTheirOwnEmpty = {tySequence, tySet, tyPtr, tyRef, tyProc} const HaveTheirOwnEmpty = {tySequence, tyOpt, tySet, tyPtr, tyRef, tyProc}
owner.flags = owner.flags + (elem.flags * {tfHasMeta}) owner.flags = owner.flags + (elem.flags * {tfHasMeta})
if tfNotNil in elem.flags: if tfNotNil in elem.flags:
if owner.kind in {tyGenericInst, tyGenericBody, tyGenericInvocation}: if owner.kind in {tyGenericInst, tyGenericBody, tyGenericInvocation}:
@ -1418,7 +1418,7 @@ proc propagateToOwner*(owner, elem: PType) =
if tfHasAsgn in elem.flags: if tfHasAsgn in elem.flags:
let o2 = elem.skipTypes({tyGenericInst, tyAlias}) let o2 = elem.skipTypes({tyGenericInst, tyAlias})
if o2.kind in {tyTuple, tyObject, tyArray, if o2.kind in {tyTuple, tyObject, tyArray,
tySequence, tySet, tyDistinct}: tySequence, tyOpt, tySet, tyDistinct}:
o2.flags.incl tfHasAsgn o2.flags.incl tfHasAsgn
owner.flags.incl tfHasAsgn owner.flags.incl tfHasAsgn