fix tsemistatic

This commit is contained in:
Zahary Karadjov
2014-03-10 20:58:45 +02:00
parent 1546d210c5
commit 71695ab791
4 changed files with 23 additions and 11 deletions

View File

@@ -1291,7 +1291,7 @@ proc skipTypes*(t: PType, kinds: TTypeKinds): PType =
proc propagateToOwner*(owner, elem: PType) =
const HaveTheirOwnEmpty = {tySequence, tySet}
owner.flags = owner.flags + (elem.flags * {tfHasShared, tfHasMeta,
tfHasStatic, tfHasGCedMem})
tfHasGCedMem})
if tfNotNil in elem.flags:
if owner.kind in {tyGenericInst, tyGenericBody, tyGenericInvokation}:
owner.flags.incl tfNotNil
@@ -1308,9 +1308,6 @@ proc propagateToOwner*(owner, elem: PType) =
if elem.kind in tyMetaTypes:
owner.flags.incl tfHasMeta
if elem.kind == tyStatic:
owner.flags.incl tfHasStatic
if elem.kind in {tyString, tyRef, tySequence} or
elem.kind == tyProc and elem.callConv == ccClosure:
owner.flags.incl tfHasGCedMem

View File

@@ -719,19 +719,19 @@ proc handleError(msg: TMsgKind, eh: TErrorHandling, s: string) =
writeStackTrace()
quit 1
if msg >= fatalMin and msg <= fatalMax:
if msg >= fatalMin and msg <= fatalMax:
quit()
if msg >= errMin and msg <= errMax:
if msg >= errMin and msg <= errMax:
inc(gErrorCounter)
options.gExitcode = 1'i8
if gErrorCounter >= gErrorMax:
if gErrorCounter >= gErrorMax:
quit()
elif eh == doAbort and gCmd != cmdIdeTools:
quit()
elif eh == doRaise:
raiseRecoverableError(s)
proc `==`*(a, b: TLineInfo): bool =
proc `==`*(a, b: TLineInfo): bool =
result = a.line == b.line and a.fileIndex == b.fileIndex
proc writeContext(lastinfo: TLineInfo) =

View File

@@ -219,14 +219,26 @@ proc tryConstExpr(c: PContext, n: PNode): PNode =
result = getConstExpr(c.module, e)
if result != nil: return
let oldErrorCount = msgs.gErrorCounter
let oldErrorMax = msgs.gErrorMax
let oldErrorOutputs = errorOutputs
errorOutputs = {}
msgs.gErrorMax = high(int)
try:
result = evalConstExpr(c.module, e)
if result == nil or result.kind == nkEmpty:
return nil
result = nil
else:
result = fixupTypeAfterEval(c, result, e)
result = fixupTypeAfterEval(c, result, e)
except ERecoverableError:
return nil
result = nil
msgs.gErrorCounter = oldErrorCount
msgs.gErrorMax = oldErrorMax
errorOutputs = oldErrorOutputs
proc semConstExpr(c: PContext, n: PNode): PNode =
var e = semExprWithType(c, n)

View File

@@ -236,17 +236,20 @@ proc makeAndType*(c: PContext, t1, t2: PType): PType =
result.sons = @[t1, t2]
propagateToOwner(result, t1)
propagateToOwner(result, t2)
result.flags.incl((t1.flags + t2.flags) * {tfHasStatic})
proc makeOrType*(c: PContext, t1, t2: PType): PType =
result = newTypeS(tyOr, c)
result.sons = @[t1, t2]
propagateToOwner(result, t1)
propagateToOwner(result, t2)
result.flags.incl((t1.flags + t2.flags) * {tfHasStatic})
proc makeNotType*(c: PContext, t1: PType): PType =
result = newTypeS(tyNot, c)
result.sons = @[t1]
propagateToOwner(result, t1)
result.flags.incl(t1.flags * {tfHasStatic})
proc newTypeS(kind: TTypeKind, c: PContext): PType =
result = newType(kind, getCurrOwner())