diff options
Diffstat (limited to 'compiler/sempass2.nim')
-rw-r--r-- | compiler/sempass2.nim | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 7dec557be..fb266ae3a 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -95,12 +95,12 @@ proc useVar(a: PEffects, n: PNode) = if s.id notin a.init: if {tfNeedsInit, tfNotNil} * s.typ.flags != {}: when true: - Message(n.info, warnProveInit, s.name.s) + message(n.info, warnProveInit, s.name.s) else: Message(n.info, errGenerated, "'$1' might not have been initialized" % s.name.s) else: - Message(n.info, warnUninit, s.name.s) + message(n.info, warnUninit, s.name.s) # prevent superfluous warnings about the same variable: a.init.add s.id @@ -162,8 +162,8 @@ proc mergeTags(a: PEffects, b, comesFrom: PNode) = for effect in items(b): addTag(a, effect, useLineInfo=comesFrom != nil) proc listEffects(a: PEffects) = - for e in items(a.exc): Message(e.info, hintUser, typeToString(e.typ)) - for e in items(a.tags): Message(e.info, hintUser, typeToString(e.typ)) + for e in items(a.exc): message(e.info, hintUser, typeToString(e.typ)) + for e in items(a.tags): message(e.info, hintUser, typeToString(e.typ)) proc catches(tracked: PEffects, e: PType) = let e = skipTypes(e, skipPtrs) @@ -305,21 +305,21 @@ proc notNilCheck(tracked: PEffects, n: PNode, paramType: PType) = if n.kind == nkAddr: # addr(x[]) can't be proven, but addr(x) can: if not containsNode(n, {nkDerefExpr, nkHiddenDeref}): return - elif n.kind == nkSym and n.sym.kind in RoutineKinds: + elif n.kind == nkSym and n.sym.kind in routineKinds: # 'p' is not nil obviously: return case impliesNotNil(tracked.guards, n) of impUnknown: - Message(n.info, errGenerated, + message(n.info, errGenerated, "cannot prove '$1' is not nil" % n.renderTree) of impNo: - Message(n.info, errGenerated, "'$1' is provably nil" % n.renderTree) + message(n.info, errGenerated, "'$1' is provably nil" % n.renderTree) of impYes: discard proc trackOperand(tracked: PEffects, n: PNode, paramType: PType) = let op = n.typ if op != nil and op.kind == tyProc and n.kind != nkNilLit: - InternalAssert op.n.sons[0].kind == nkEffectList + internalAssert op.n.sons[0].kind == nkEffectList var effectList = op.n.sons[0] let s = n.skipConv if s.kind == nkSym and s.sym.kind in routineKinds: @@ -367,7 +367,7 @@ proc trackCase(tracked: PEffects, n: PNode) = for i in oldState.. <tracked.init.len: addToIntersection(inter, tracked.init[i]) - let exh = case skipTypes(n.sons[0].Typ, abstractVarRange-{tyTypeDesc}).Kind + let exh = case skipTypes(n.sons[0].typ, abstractVarRange-{tyTypeDesc}).kind of tyFloat..tyFloat128, tyString: lastSon(n).kind == nkElse else: @@ -549,7 +549,7 @@ proc checkRaisesSpec(spec, real: PNode, msg: string, hints: bool) = if hints: for s in 0 .. <spec.len: if not used.contains(s): - Message(spec[s].info, hintXDeclaredButNotUsed, renderTree(spec[s])) + message(spec[s].info, hintXDeclaredButNotUsed, renderTree(spec[s])) proc checkMethodEffects*(disp, branch: PSym) = ## checks for consistent effects for multi methods. @@ -568,13 +568,13 @@ proc checkMethodEffects*(disp, branch: PSym) = proc setEffectsForProcType*(t: PType, n: PNode) = var effects = t.n.sons[0] - InternalAssert t.kind == tyProc and effects.kind == nkEffectList + internalAssert t.kind == tyProc and effects.kind == nkEffectList let raisesSpec = effectSpec(n, wRaises) tagsSpec = effectSpec(n, wTags) if not isNil(raisesSpec) or not isNil(tagsSpec): - InternalAssert effects.len == 0 + internalAssert effects.len == 0 newSeq(effects.sons, effectListLen) if not isNil(raisesSpec): effects.sons[exceptionEffects] = raisesSpec @@ -583,7 +583,7 @@ proc setEffectsForProcType*(t: PType, n: PNode) = proc trackProc*(s: PSym, body: PNode) = var effects = s.typ.n.sons[0] - InternalAssert effects.kind == nkEffectList + internalAssert effects.kind == nkEffectList # effects already computed? if sfForward in s.flags: return if effects.len == effectListLen: return @@ -603,7 +603,7 @@ proc trackProc*(s: PSym, body: PNode) = s.kind in {skProc, skConverter, skMethod}: var res = s.ast.sons[resultPos].sym # get result symbol if res.id notin t.init: - Message(body.info, warnProveInit, "result") + message(body.info, warnProveInit, "result") let p = s.ast.sons[pragmasPos] let raisesSpec = effectSpec(p, wRaises) if not isNil(raisesSpec): @@ -618,4 +618,4 @@ proc trackProc*(s: PSym, body: PNode) = hints=off) # after the check, use the formal spec: effects.sons[tagEffects] = tagsSpec - \ No newline at end of file + |