fix tsemistatic
This commit is contained in:
parent
1546d210c5
commit
71695ab791
4 changed files with 23 additions and 11 deletions
|
|
@ -1291,7 +1291,7 @@ proc skipTypes*(t: PType, kinds: TTypeKinds): PType =
|
||||||
proc propagateToOwner*(owner, elem: PType) =
|
proc propagateToOwner*(owner, elem: PType) =
|
||||||
const HaveTheirOwnEmpty = {tySequence, tySet}
|
const HaveTheirOwnEmpty = {tySequence, tySet}
|
||||||
owner.flags = owner.flags + (elem.flags * {tfHasShared, tfHasMeta,
|
owner.flags = owner.flags + (elem.flags * {tfHasShared, tfHasMeta,
|
||||||
tfHasStatic, tfHasGCedMem})
|
tfHasGCedMem})
|
||||||
if tfNotNil in elem.flags:
|
if tfNotNil in elem.flags:
|
||||||
if owner.kind in {tyGenericInst, tyGenericBody, tyGenericInvokation}:
|
if owner.kind in {tyGenericInst, tyGenericBody, tyGenericInvokation}:
|
||||||
owner.flags.incl tfNotNil
|
owner.flags.incl tfNotNil
|
||||||
|
|
@ -1308,9 +1308,6 @@ proc propagateToOwner*(owner, elem: PType) =
|
||||||
if elem.kind in tyMetaTypes:
|
if elem.kind in tyMetaTypes:
|
||||||
owner.flags.incl tfHasMeta
|
owner.flags.incl tfHasMeta
|
||||||
|
|
||||||
if elem.kind == tyStatic:
|
|
||||||
owner.flags.incl tfHasStatic
|
|
||||||
|
|
||||||
if elem.kind in {tyString, tyRef, tySequence} or
|
if elem.kind in {tyString, tyRef, tySequence} or
|
||||||
elem.kind == tyProc and elem.callConv == ccClosure:
|
elem.kind == tyProc and elem.callConv == ccClosure:
|
||||||
owner.flags.incl tfHasGCedMem
|
owner.flags.incl tfHasGCedMem
|
||||||
|
|
|
||||||
|
|
@ -219,14 +219,26 @@ proc tryConstExpr(c: PContext, n: PNode): PNode =
|
||||||
result = getConstExpr(c.module, e)
|
result = getConstExpr(c.module, e)
|
||||||
if result != nil: return
|
if result != nil: return
|
||||||
|
|
||||||
|
let oldErrorCount = msgs.gErrorCounter
|
||||||
|
let oldErrorMax = msgs.gErrorMax
|
||||||
|
let oldErrorOutputs = errorOutputs
|
||||||
|
|
||||||
|
errorOutputs = {}
|
||||||
|
msgs.gErrorMax = high(int)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = evalConstExpr(c.module, e)
|
result = evalConstExpr(c.module, e)
|
||||||
if result == nil or result.kind == nkEmpty:
|
if result == nil or result.kind == nkEmpty:
|
||||||
return nil
|
result = nil
|
||||||
|
else:
|
||||||
result = fixupTypeAfterEval(c, result, e)
|
result = fixupTypeAfterEval(c, result, e)
|
||||||
|
|
||||||
except ERecoverableError:
|
except ERecoverableError:
|
||||||
return nil
|
result = nil
|
||||||
|
|
||||||
|
msgs.gErrorCounter = oldErrorCount
|
||||||
|
msgs.gErrorMax = oldErrorMax
|
||||||
|
errorOutputs = oldErrorOutputs
|
||||||
|
|
||||||
proc semConstExpr(c: PContext, n: PNode): PNode =
|
proc semConstExpr(c: PContext, n: PNode): PNode =
|
||||||
var e = semExprWithType(c, n)
|
var e = semExprWithType(c, n)
|
||||||
|
|
|
||||||
|
|
@ -236,17 +236,20 @@ proc makeAndType*(c: PContext, t1, t2: PType): PType =
|
||||||
result.sons = @[t1, t2]
|
result.sons = @[t1, t2]
|
||||||
propagateToOwner(result, t1)
|
propagateToOwner(result, t1)
|
||||||
propagateToOwner(result, t2)
|
propagateToOwner(result, t2)
|
||||||
|
result.flags.incl((t1.flags + t2.flags) * {tfHasStatic})
|
||||||
|
|
||||||
proc makeOrType*(c: PContext, t1, t2: PType): PType =
|
proc makeOrType*(c: PContext, t1, t2: PType): PType =
|
||||||
result = newTypeS(tyOr, c)
|
result = newTypeS(tyOr, c)
|
||||||
result.sons = @[t1, t2]
|
result.sons = @[t1, t2]
|
||||||
propagateToOwner(result, t1)
|
propagateToOwner(result, t1)
|
||||||
propagateToOwner(result, t2)
|
propagateToOwner(result, t2)
|
||||||
|
result.flags.incl((t1.flags + t2.flags) * {tfHasStatic})
|
||||||
|
|
||||||
proc makeNotType*(c: PContext, t1: PType): PType =
|
proc makeNotType*(c: PContext, t1: PType): PType =
|
||||||
result = newTypeS(tyNot, c)
|
result = newTypeS(tyNot, c)
|
||||||
result.sons = @[t1]
|
result.sons = @[t1]
|
||||||
propagateToOwner(result, t1)
|
propagateToOwner(result, t1)
|
||||||
|
result.flags.incl(t1.flags * {tfHasStatic})
|
||||||
|
|
||||||
proc newTypeS(kind: TTypeKind, c: PContext): PType =
|
proc newTypeS(kind: TTypeKind, c: PContext): PType =
|
||||||
result = newType(kind, getCurrOwner())
|
result = newType(kind, getCurrOwner())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue