diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ast.nim | 5 | ||||
-rw-r--r-- | compiler/msgs.nim | 8 | ||||
-rw-r--r-- | compiler/sem.nim | 18 | ||||
-rw-r--r-- | compiler/semdata.nim | 3 |
4 files changed, 23 insertions, 11 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index f9cab0d88..ee0d55920 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -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 diff --git a/compiler/msgs.nim b/compiler/msgs.nim index 5bc490d14..c75876843 100644 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -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) = diff --git a/compiler/sem.nim b/compiler/sem.nim index c8228618b..093fc9452 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -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) diff --git a/compiler/semdata.nim b/compiler/semdata.nim index d942aa41e..84e017050 100644 --- a/compiler/semdata.nim +++ b/compiler/semdata.nim @@ -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()) |