diff options
author | Araq <rumpf_a@web.de> | 2013-12-27 23:10:36 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-12-27 23:10:36 +0100 |
commit | 92b8fac94a7243cde785d985db3fd86b6025b079 (patch) | |
tree | edbfdbab6cf496d6a0cfe226957769c3c43d2fa9 /compiler/semexprs.nim | |
parent | 706266d8b728b19fde6d69fd6ccdfb65ae7b6a17 (diff) | |
download | Nim-92b8fac94a7243cde785d985db3fd86b6025b079.tar.gz |
case consistency part 4
Diffstat (limited to 'compiler/semexprs.nim')
-rw-r--r-- | compiler/semexprs.nim | 178 |
1 files changed, 89 insertions, 89 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 5f41a8dd9..43091aa74 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -30,7 +30,7 @@ proc semOperand(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = # XXX tyGenericInst here? if result.typ.kind == tyVar: result = newDeref(result) else: - LocalError(n.info, errExprXHasNoType, + localError(n.info, errExprXHasNoType, renderTree(result, {renderNoComments})) result.typ = errorType(c) @@ -40,9 +40,9 @@ proc semExprWithType(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = # do not produce another redundant error message: #raiseRecoverableError("") result = errorNode(c, n) - if result.typ == nil or result.typ == EnforceVoidContext: + if result.typ == nil or result.typ == enforceVoidContext: # we cannot check for 'void' in macros ... - LocalError(n.info, errExprXHasNoType, + localError(n.info, errExprXHasNoType, renderTree(result, {renderNoComments})) result.typ = errorType(c) else: @@ -57,7 +57,7 @@ proc semExprNoDeref(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = # do not produce another redundant error message: result = errorNode(c, n) if result.typ == nil: - LocalError(n.info, errExprXHasNoType, + localError(n.info, errExprXHasNoType, renderTree(result, {renderNoComments})) result.typ = errorType(c) else: @@ -117,7 +117,7 @@ proc semSym(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode = elif s.ast != nil: result = semExpr(c, s.ast) else: - InternalError(n.info, "no default for") + internalError(n.info, "no default for") result = emptyNode of skType: markUsed(n, s) @@ -175,7 +175,7 @@ proc isCastable(dst, src: PType): bool = # castableTypeKinds = {tyInt, tyPtr, tyRef, tyCstring, tyString, # tySequence, tyPointer, tyNil, tyOpenArray, # tyProc, tySet, tyEnum, tyBool, tyChar} - var ds, ss: biggestInt + var ds, ss: BiggestInt # this is very unrestrictive; cast is allowed if castDest.size >= src.size ds = computeSize(dst) ss = computeSize(src) @@ -193,7 +193,7 @@ proc isSymChoice(n: PNode): bool {.inline.} = proc semConv(c: PContext, n: PNode): PNode = if sonsLen(n) != 2: - LocalError(n.info, errConvNeedsOneArg) + localError(n.info, errConvNeedsOneArg) return n result = newNodeI(nkConv, n.info) result.typ = semTypeNode(c, n.sons[0], nil).skipTypes({tyGenericInst}) @@ -206,9 +206,9 @@ proc semConv(c: PContext, n: PNode): PNode = case status of convOK: nil of convNotNeedeed: - Message(n.info, hintConvFromXtoItselfNotNeeded, result.typ.typeToString) + message(n.info, hintConvFromXtoItselfNotNeeded, result.typ.typeToString) of convNotLegal: - LocalError(n.info, errGenerated, MsgKindToString(errIllegalConvFromXtoY)% + localError(n.info, errGenerated, msgKindToString(errIllegalConvFromXtoY)% [op.typ.typeToString, result.typ.typeToString]) else: for i in countup(0, sonsLen(op) - 1): @@ -229,14 +229,14 @@ proc semCast(c: PContext, n: PNode): PNode = addSon(result, copyTree(n.sons[0])) addSon(result, semExprWithType(c, n.sons[1])) if not isCastable(result.typ, result.sons[1].Typ): - LocalError(result.info, errExprCannotBeCastedToX, + localError(result.info, errExprCannotBeCastedToX, typeToString(result.Typ)) proc semLowHigh(c: PContext, n: PNode, m: TMagic): PNode = const opToStr: array[mLow..mHigh, string] = ["low", "high"] if sonsLen(n) != 2: - LocalError(n.info, errXExpectsTypeOrValue, opToStr[m]) + localError(n.info, errXExpectsTypeOrValue, opToStr[m]) else: n.sons[1] = semExprWithType(c, n.sons[1], {efDetermineType}) var typ = skipTypes(n.sons[1].typ, abstractVarRange) @@ -252,12 +252,12 @@ proc semLowHigh(c: PContext, n: PNode, m: TMagic): PNode = # leave it for now, it will be resolved in semtypinst n.typ = getSysType(tyInt) else: - LocalError(n.info, errInvalidArgForX, opToStr[m]) + localError(n.info, errInvalidArgForX, opToStr[m]) result = n proc semSizeof(c: PContext, n: PNode): PNode = if sonsLen(n) != 2: - LocalError(n.info, errXExpectsTypeOrValue, "sizeof") + localError(n.info, errXExpectsTypeOrValue, "sizeof") else: n.sons[1] = semExprWithType(c, n.sons[1], {efDetermineType}) #restoreOldStyleType(n.sons[1]) @@ -276,9 +276,9 @@ proc semOf(c: PContext, n: PNode): PNode = let y = skipTypes(n.sons[2].typ, abstractPtrs-{tyTypeDesc}) if x.kind == tyTypeDesc or y.kind != tyTypeDesc: - LocalError(n.info, errXExpectsObjectTypes, "of") + localError(n.info, errXExpectsObjectTypes, "of") elif b.kind != tyObject or a.kind != tyObject: - LocalError(n.info, errXExpectsObjectTypes, "of") + localError(n.info, errXExpectsObjectTypes, "of") else: let diff = inheritanceDiff(a, b) # | returns: 0 iff `a` == `b` @@ -287,15 +287,15 @@ proc semOf(c: PContext, n: PNode): PNode = # | returns: `maxint` iff `a` and `b` are not compatible at all if diff <= 0: # optimize to true: - Message(n.info, hintConditionAlwaysTrue, renderTree(n)) + message(n.info, hintConditionAlwaysTrue, renderTree(n)) result = newIntNode(nkIntLit, 1) result.info = n.info result.typ = getSysType(tyBool) return result elif diff == high(int): - LocalError(n.info, errXcanNeverBeOfThisSubtype, typeToString(a)) + localError(n.info, errXcanNeverBeOfThisSubtype, typeToString(a)) else: - LocalError(n.info, errXExpectsTwoArguments, "of") + localError(n.info, errXExpectsTwoArguments, "of") n.typ = getSysType(tyBool) result = n @@ -324,15 +324,15 @@ proc isOpImpl(c: PContext, n: PNode): PNode = case t2.kind of tyTypeClasses: var m: TCandidate - InitCandidate(m, t2) + initCandidate(m, t2) match = matchUserTypeClass(c, m, emptyNode, t2, t1) != nil of tyOrdinal: var m: TCandidate - InitCandidate(m, t2) + initCandidate(m, t2) match = isOrdinalType(t1) of tySequence, tyArray, tySet: var m: TCandidate - InitCandidate(m, t2) + initCandidate(m, t2) match = typeRel(m, t2, t1) != isNone else: match = sameType(t1, t2) @@ -343,7 +343,7 @@ proc isOpImpl(c: PContext, n: PNode): PNode = proc semIs(c: PContext, n: PNode): PNode = if sonsLen(n) != 3: - LocalError(n.info, errXExpectsTwoArguments, "is") + localError(n.info, errXExpectsTwoArguments, "is") result = n n.typ = getSysType(tyBool) @@ -394,7 +394,7 @@ proc changeType(n: PNode, newType: PType, check: bool) = changeType(n.sons[i], elemType(newType), check) of nkPar: if newType.kind != tyTuple: - InternalError(n.info, "changeType: no tuple type for constructor") + internalError(n.info, "changeType: no tuple type for constructor") elif newType.n == nil: nil elif sonsLen(n) > 0 and n.sons[0].kind == nkExprColonExpr: for i in countup(0, sonsLen(n) - 1): @@ -419,7 +419,7 @@ proc changeType(n: PNode, newType: PType, check: bool) = if check: let value = n.intVal if value < firstOrd(newType) or value > lastOrd(newType): - LocalError(n.info, errGenerated, "cannot convert " & $value & + localError(n.info, errGenerated, "cannot convert " & $value & " to " & typeToString(newType)) else: nil n.typ = newType @@ -431,7 +431,7 @@ proc arrayConstrType(c: PContext, n: PNode): PType = rawAddSon(typ, newTypeS(tyEmpty, c)) # needs an empty basetype! else: var x = n.sons[0] - var lastIndex: biggestInt = sonsLen(n) - 1 + var lastIndex: BiggestInt = sonsLen(n) - 1 var t = skipTypes(n.sons[0].typ, {tyGenericInst, tyVar, tyOrdinal}) addSonSkipIntLit(typ, t) typ.sons[0] = makeRangeType(c, 0, sonsLen(n) - 1, n.info) @@ -445,7 +445,7 @@ proc semArrayConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = rawAddSon(result.typ, newTypeS(tyEmpty, c)) # needs an empty basetype! else: var x = n.sons[0] - var lastIndex: biggestInt = 0 + var lastIndex: BiggestInt = 0 var indexType = getSysType(tyInt) if x.kind == nkExprColonExpr and sonsLen(x) == 2: var idx = semConstExpr(c, x.sons[0]) @@ -582,7 +582,7 @@ proc analyseIfAddressTakenInCall(c: PContext, n: PNode) = skipTypes(t.sons[i], abstractInst-{tyTypeDesc}).kind == tyVar: if isAssignable(c, n.sons[i]) notin {arLValue, arLocalLValue}: if n.sons[i].kind != nkHiddenAddr: - LocalError(n.sons[i].info, errVarForOutParamNeeded) + localError(n.sons[i].info, errVarForOutParamNeeded) return for i in countup(1, sonsLen(n) - 1): if n.sons[i].kind == nkHiddenCallConv: @@ -642,7 +642,7 @@ proc evalAtCompileTime(c: PContext, n: PNode): PNode = if sfCompileTime in callee.flags: result = evalStaticExpr(c.module, call, c.p.owner) if result.isNil: - LocalError(n.info, errCannotInterpretNodeX, renderTree(call)) + localError(n.info, errCannotInterpretNodeX, renderTree(call)) else: result = evalConstExpr(c.module, call) if result.isNil: result = n @@ -653,7 +653,7 @@ proc semStaticExpr(c: PContext, n: PNode): PNode = let a = semExpr(c, n.sons[0]) result = evalStaticExpr(c.module, a, c.p.owner) if result.isNil: - LocalError(n.info, errCannotInterpretNodeX, renderTree(n)) + localError(n.info, errCannotInterpretNodeX, renderTree(n)) result = emptyNode proc semOverloadedCallAnalyseEffects(c: PContext, n: PNode, nOrig: PNode, @@ -670,14 +670,14 @@ proc semOverloadedCallAnalyseEffects(c: PContext, n: PNode, nOrig: PNode, {skProc, skMethod, skConverter, skMacro, skTemplate}) if result != nil: if result.sons[0].kind != nkSym: - InternalError("semOverloadedCallAnalyseEffects") + internalError("semOverloadedCallAnalyseEffects") return let callee = result.sons[0].sym case callee.kind of skMacro, skTemplate: nil else: if (callee.kind == skIterator) and (callee.id == c.p.owner.id): - LocalError(n.info, errRecursiveDependencyX, callee.name.s) + localError(n.info, errRecursiveDependencyX, callee.name.s) if sfNoSideEffect notin callee.flags: if {sfImportc, sfSideEffect} * callee.flags != {}: incl(c.p.owner.flags, sfSideEffect) @@ -711,7 +711,7 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags): PNode = if m.state != csMatch: if c.inCompilesContext > 0: # speed up error generation: - GlobalError(n.Info, errTypeMismatch, "") + globalError(n.Info, errTypeMismatch, "") return emptyNode else: var hasErrorType = false @@ -726,7 +726,7 @@ proc semIndirectOp(c: PContext, n: PNode, flags: TExprFlags): PNode = if not hasErrorType: add(msg, ")\n" & msgKindToString(errButExpected) & "\n" & typeToString(n.sons[0].typ)) - LocalError(n.Info, errGenerated, msg) + localError(n.Info, errGenerated, msg) return errorNode(c, n) result = nil else: @@ -801,7 +801,7 @@ proc semEcho(c: PContext, n: PNode): PNode = let t = arg.typ if (t == nil or t.skipTypes(abstractInst).kind != tyString) and arg.kind != nkEmpty: - LocalError(n.info, errGenerated, + localError(n.info, errGenerated, "implicitly invoked '$' does not return string") let t = n.sons[0].typ if tfNoSideEffect notin t.flags: incl(c.p.owner.flags, sfSideEffect) @@ -810,11 +810,11 @@ proc semEcho(c: PContext, n: PNode): PNode = proc buildEchoStmt(c: PContext, n: PNode): PNode = # we MUST not check 'n' for semantics again here! result = newNodeI(nkCall, n.info) - var e = StrTableGet(magicsys.systemModule.Tab, getIdent"echo") + var e = strTableGet(magicsys.systemModule.Tab, getIdent"echo") if e != nil: addSon(result, newSymNode(e)) else: - LocalError(n.info, errSystemNeeds, "echo") + localError(n.info, errSystemNeeds, "echo") addSon(result, errorNode(c, n)) var arg = buildStringify(c, n) # problem is: implicit '$' is not checked for semantics yet. So we give up @@ -844,7 +844,7 @@ proc lookupInRecordAndBuildCheck(c: PContext, n, r: PNode, field: PIdent, if result != nil: return of nkRecCase: checkMinSonsLen(r, 2) - if (r.sons[0].kind != nkSym): IllFormedAst(r) + if (r.sons[0].kind != nkSym): illFormedAst(r) result = lookupInRecordAndBuildCheck(c, n, r.sons[0], field, check) if result != nil: return var s = newNodeI(nkCurly, r.info) @@ -906,7 +906,7 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode = # early exit for this; see tests/compile/tbindoverload.nim: if isSymChoice(n.sons[1]): return - var s = qualifiedLookup(c, n, {checkAmbiguity, checkUndeclared}) + var s = qualifiedLookUp(c, n, {checkAmbiguity, checkUndeclared}) if s != nil: return semSym(c, n, s, flags) @@ -1038,7 +1038,7 @@ proc semSubscript(c: PContext, n: PNode, flags: TExprFlags): PNode = n.sons[i] = semExprWithType(c, n.sons[i], flags*{efInTypeof, efDetermineType}) var indexType = if arr.kind == tyArray: arr.sons[0] else: getSysType(tyInt) - var arg = IndexTypesMatch(c, indexType, n.sons[1].typ, n.sons[1]) + var arg = indexTypesMatch(c, indexType, n.sons[1].typ, n.sons[1]) if arg != nil: n.sons[1] = arg result = n @@ -1060,9 +1060,9 @@ proc semSubscript(c: PContext, n: PNode, flags: TExprFlags): PNode = {tyInt..tyInt64}: var idx = getOrdValue(n.sons[1]) if idx >= 0 and idx < sonsLen(arr): n.typ = arr.sons[int(idx)] - else: LocalError(n.info, errInvalidIndexValueForTuple) + else: localError(n.info, errInvalidIndexValueForTuple) else: - LocalError(n.info, errIndexTypesDoNotMatch) + localError(n.info, errIndexTypesDoNotMatch) result = n else: nil @@ -1098,9 +1098,9 @@ proc takeImplicitAddr(c: PContext, n: PNode): PNode = var valid = isAssignable(c, n) if valid != arLValue: if valid == arLocalLValue: - LocalError(n.info, errXStackEscape, renderTree(n, {renderNoComments})) + localError(n.info, errXStackEscape, renderTree(n, {renderNoComments})) else: - LocalError(n.info, errExprHasNoAddress) + localError(n.info, errExprHasNoAddress) result = newNodeIT(nkHiddenAddr, n.info, makePtrType(c, n.typ)) result.add(n) @@ -1149,7 +1149,7 @@ proc semAsgn(c: PContext, n: PNode): PNode = # a = b # b no 'var T' means: a = addr(b) var le = a.typ if skipTypes(le, {tyGenericInst}).kind != tyVar and - IsAssignable(c, a) == arNone: + isAssignable(c, a) == arNone: # Direct assignment to a discriminant is allowed! localError(a.info, errXCannotBeAssignedTo, renderTree(a, {renderNoComments})) @@ -1161,7 +1161,7 @@ proc semAsgn(c: PContext, n: PNode): PNode = rhs = semExprWithType(c, n.sons[1], if lhsIsResult: {efAllowDestructor} else: {}) if lhsIsResult: - n.typ = EnforceVoidContext + n.typ = enforceVoidContext if lhs.sym.typ.kind == tyGenericParam: if matchTypeClass(lhs.typ, rhs.typ): InternalAssert c.p.resultSym != nil @@ -1192,9 +1192,9 @@ proc semReturn(c: PContext, n: PNode): PNode = if n[0][1].kind == nkSym and n[0][1].sym == c.p.resultSym: n.sons[0] = ast.emptyNode else: - LocalError(n.info, errNoReturnTypeDeclared) + localError(n.info, errNoReturnTypeDeclared) else: - LocalError(n.info, errXNotAllowedHere, "\'return\'") + localError(n.info, errXNotAllowedHere, "\'return\'") proc semProcBody(c: PContext, n: PNode): PNode = openScope(c) @@ -1246,16 +1246,16 @@ proc semYield(c: PContext, n: PNode): PNode = result = n checkSonsLen(n, 1) if c.p.owner == nil or c.p.owner.kind != skIterator: - LocalError(n.info, errYieldNotAllowedHere) + localError(n.info, errYieldNotAllowedHere) elif c.p.inTryStmt > 0 and c.p.owner.typ.callConv != ccInline: - LocalError(n.info, errYieldNotAllowedInTryStmt) + localError(n.info, errYieldNotAllowedInTryStmt) elif n.sons[0].kind != nkEmpty: - n.sons[0] = SemExprWithType(c, n.sons[0]) # check for type compatibility: + n.sons[0] = semExprWithType(c, n.sons[0]) # check for type compatibility: var restype = c.p.owner.typ.sons[0] if restype != nil: n.sons[0] = fitNode(c, restype, n.sons[0]) - if n.sons[0].typ == nil: InternalError(n.info, "semYield") - SemYieldVarResult(c, n, restype) + if n.sons[0].typ == nil: internalError(n.info, "semYield") + semYieldVarResult(c, n, restype) else: localError(n.info, errCannotReturnExpr) elif c.p.owner.typ.sons[0] != nil: @@ -1270,12 +1270,12 @@ proc lookUpForDefined(c: PContext, i: PIdent, onlyCurrentScope: bool): PSym = proc lookUpForDefined(c: PContext, n: PNode, onlyCurrentScope: bool): PSym = case n.kind of nkIdent: - result = lookupForDefined(c, n.ident, onlyCurrentScope) + result = lookUpForDefined(c, n.ident, onlyCurrentScope) of nkDotExpr: result = nil if onlyCurrentScope: return checkSonsLen(n, 2) - var m = lookupForDefined(c, n.sons[0], onlyCurrentScope) + var m = lookUpForDefined(c, n.sons[0], onlyCurrentScope) if (m != nil) and (m.kind == skModule): if (n.sons[1].kind == nkIdent): var ident = n.sons[1].ident @@ -1286,7 +1286,7 @@ proc lookUpForDefined(c: PContext, n: PNode, onlyCurrentScope: bool): PSym = else: localError(n.sons[1].info, errIdentifierExpected, "") of nkAccQuoted: - result = lookupForDefined(c, considerAcc(n), onlyCurrentScope) + result = lookUpForDefined(c, considerAcc(n), onlyCurrentScope) of nkSym: result = n.sym else: @@ -1297,7 +1297,7 @@ proc semDefined(c: PContext, n: PNode, onlyCurrentScope: bool): PNode = checkSonsLen(n, 2) # we replace this node by a 'true' or 'false' node: result = newIntNode(nkIntLit, 0) - if LookUpForDefined(c, n.sons[1], onlyCurrentScope) != nil: + if lookUpForDefined(c, n.sons[1], onlyCurrentScope) != nil: result.intVal = 1 elif not onlyCurrentScope and (n.sons[1].kind == nkIdent) and condsyms.isDefined(n.sons[1].ident): @@ -1314,18 +1314,18 @@ proc expectMacroOrTemplateCall(c: PContext, n: PNode): PSym = ## The argument to the proc should be nkCall(...) or similar ## Returns the macro/template symbol if isCallExpr(n): - var expandedSym = qualifiedLookup(c, n[0], {checkUndeclared}) + var expandedSym = qualifiedLookUp(c, n[0], {checkUndeclared}) if expandedSym == nil: - LocalError(n.info, errUndeclaredIdentifier, n[0].renderTree) + localError(n.info, errUndeclaredIdentifier, n[0].renderTree) return errorSym(c, n[0]) if expandedSym.kind notin {skMacro, skTemplate}: - LocalError(n.info, errXisNoMacroOrTemplate, expandedSym.name.s) + localError(n.info, errXisNoMacroOrTemplate, expandedSym.name.s) return errorSym(c, n[0]) result = expandedSym else: - LocalError(n.info, errXisNoMacroOrTemplate, n.renderTree) + localError(n.info, errXisNoMacroOrTemplate, n.renderTree) result = errorSym(c, n) proc expectString(c: PContext, n: PNode): string = @@ -1333,10 +1333,10 @@ proc expectString(c: PContext, n: PNode): string = if n.kind in nkStrKinds: return n.strVal else: - LocalError(n.info, errStringLiteralExpected) + localError(n.info, errStringLiteralExpected) proc getMagicSym(magic: TMagic): PSym = - result = newSym(skProc, getIdent($magic), GetCurrOwner(), gCodegenLineInfo) + result = newSym(skProc, getIdent($magic), getCurrOwner(), gCodegenLineInfo) result.magic = magic proc newAnonSym(kind: TSymKind, info: TLineInfo, @@ -1358,7 +1358,7 @@ proc semUsing(c: PContext, n: PNode): PNode = continue else: nil - LocalError(e.info, errUsingNoSymbol, e.renderTree) + localError(e.info, errUsingNoSymbol, e.renderTree) proc semExpandToAst(c: PContext, n: PNode): PNode = var macroCall = n[1] @@ -1422,7 +1422,7 @@ proc semQuoteAst(c: PContext, n: PNode): PNode = # this will store the generated param names if doBlk.kind != nkDo: - LocalError(n.info, errXExpected, "block") + localError(n.info, errXExpected, "block") processQuotations(doBlk.sons[bodyPos], op, quotes, ids) @@ -1476,7 +1476,7 @@ proc tryExpr(c: PContext, n: PNode, c.InGenericInst = oldInGenericInst c.p = oldProcCon msgs.setInfoContextLen(oldContextLen) - setlen(gOwners, oldOwnerLen) + setLen(gOwners, oldOwnerLen) c.currentScope = oldScope dec c.InCompilesContext errorOutputs = oldErrorOutputs @@ -1556,7 +1556,7 @@ proc semWhen(c: PContext, n: PNode, semCheck = true): PNode = # The ``when`` statement implements the mechanism for platform dependent # code. Thus we try to ensure here consistent ID allocation after the # ``when`` statement. - IDsynchronizationPoint(200) + idSynchronizationPoint(200) proc semSetConstr(c: PContext, n: PNode): PNode = result = newNodeI(nkCurly, n.info) @@ -1585,7 +1585,7 @@ proc semSetConstr(c: PContext, n: PNode): PNode = if typ == nil: typ = skipTypes(n.sons[i].typ, {tyGenericInst, tyVar, tyOrdinal}) if not isOrdinalType(typ): - LocalError(n.info, errOrdinalTypeExpected) + localError(n.info, errOrdinalTypeExpected) typ = makeRangeType(c, 0, MaxSetElements - 1, n.info) elif lengthOrd(typ) > MaxSetElements: typ = makeRangeType(c, 0, MaxSetElements - 1, n.info) @@ -1642,11 +1642,11 @@ proc checkPar(n: PNode): TParKind = if result == paTupleFields: if (n.sons[i].kind != nkExprColonExpr) or not (n.sons[i].sons[0].kind in {nkSym, nkIdent}): - LocalError(n.sons[i].info, errNamedExprExpected) + localError(n.sons[i].info, errNamedExprExpected) return paNone else: if n.sons[i].kind == nkExprColonExpr: - LocalError(n.sons[i].info, errNamedExprNotAllowed) + localError(n.sons[i].info, errNamedExprNotAllowed) return paNone proc semTupleFieldsConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = @@ -1661,7 +1661,7 @@ proc semTupleFieldsConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = var id: PIdent if n.sons[i].sons[0].kind == nkIdent: id = n.sons[i].sons[0].ident else: id = n.sons[i].sons[0].sym.name - if ContainsOrIncl(ids, id.id): + if containsOrIncl(ids, id.id): localError(n.sons[i].info, errFieldInitTwice, id.s) n.sons[i].sons[1] = semExprWithType(c, n.sons[i].sons[1], flags*{efAllowDestructor}) @@ -1688,7 +1688,7 @@ proc checkInitialized(n: PNode, ids: TIntSet, info: TLineInfo) = for i in countup(0, sonsLen(n) - 1): checkInitialized(n.sons[i], ids, info) of nkRecCase: - if (n.sons[0].kind != nkSym): InternalError(info, "checkInitialized") + if (n.sons[0].kind != nkSym): internalError(info, "checkInitialized") checkInitialized(n.sons[0], ids, info) when false: # XXX we cannot check here, as we don't know the branch! @@ -1698,7 +1698,7 @@ proc checkInitialized(n: PNode, ids: TIntSet, info: TLineInfo) = else: internalError(info, "checkInitialized") of nkSym: if tfNeedsInit in n.sym.typ.flags and n.sym.name.id notin ids: - Message(info, errGenerated, "field not initialized: " & n.sym.name.s) + message(info, errGenerated, "field not initialized: " & n.sym.name.s) else: internalError(info, "checkInitialized") proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = @@ -1721,7 +1721,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = var id: PIdent if it.sons[0].kind == nkIdent: id = it.sons[0].ident else: id = it.sons[0].sym.name - if ContainsOrIncl(ids, id.id): + if containsOrIncl(ids, id.id): localError(it.info, errFieldInitTwice, id.s) var e = semExprWithType(c, it.sons[1], flags*{efAllowDestructor}) var @@ -1754,7 +1754,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = proc semBlock(c: PContext, n: PNode): PNode = result = n - Inc(c.p.nestedBlockCounter) + inc(c.p.nestedBlockCounter) checkSonsLen(n, 2) openScope(c) # BUGFIX: label is in the scope of block! if n.sons[0].kind != nkEmpty: @@ -1768,7 +1768,7 @@ proc semBlock(c: PContext, n: PNode): PNode = if isEmptyType(n.typ): n.kind = nkBlockStmt else: n.kind = nkBlockExpr closeScope(c) - Dec(c.p.nestedBlockCounter) + dec(c.p.nestedBlockCounter) proc buildCall(n: PNode): PNode = if n.kind == nkDotExpr and n.len == 2: @@ -1834,7 +1834,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = if result.kind == nkSym: markIndirect(c, result.sym) if isGenericRoutine(result.sym): - LocalError(n.info, errInstantiateXExplicitely, s.name.s) + localError(n.info, errInstantiateXExplicitely, s.name.s) of nkSym: # because of the changed symbol binding, this does not mean that we # don't have to check the symbol for semantics here again! @@ -1881,7 +1881,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = result.kind = nkCall result = semExpr(c, result, flags) of nkBind: - Message(n.info, warnDeprecated, "bind") + message(n.info, warnDeprecated, "bind") result = semExpr(c, n.sons[0], flags) of nkTypeOfExpr, nkTupleTy, nkRefTy..nkEnumTy: var typ = semTypeNode(c, n, nil).skipTypes({tyTypeDesc}) @@ -1891,7 +1891,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = # check if it is an expression macro: checkMinSonsLen(n, 1) let mode = if nfDelegate in n.flags: {} else: {checkUndeclared} - var s = qualifiedLookup(c, n.sons[0], mode) + var s = qualifiedLookUp(c, n.sons[0], mode) if s != nil: case s.kind of skMacro: @@ -1912,8 +1912,8 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = result = semConv(c, n) elif n.len == 1: result = semObjConstr(c, n, flags) - elif Contains(c.AmbiguousSymbols, s.id): - LocalError(n.info, errUseQualifier, s.name.s) + elif contains(c.AmbiguousSymbols, s.id): + localError(n.info, errUseQualifier, s.name.s) elif s.magic == mNone: result = semDirectOp(c, n, flags) else: result = semMagic(c, n, s, flags) of skProc, skMethod, skConverter, skIterator: @@ -1937,7 +1937,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = result = semExpr(c, result, flags) of nkBracketExpr: checkMinSonsLen(n, 1) - var s = qualifiedLookup(c, n.sons[0], {checkUndeclared}) + var s = qualifiedLookUp(c, n.sons[0], {checkUndeclared}) if s != nil and s.kind in {skProc, skMethod, skConverter, skIterator}: # type parameters: partial generic specialization n.sons[0] = semSymGenericInstantiation(c, n.sons[0], s) @@ -1965,7 +1965,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = checkSonsLen(n, 1) n.sons[0] = semExprWithType(c, n.sons[0]) if isAssignable(c, n.sons[0]) notin {arLValue, arLocalLValue}: - LocalError(n.info, errExprHasNoAddress) + localError(n.info, errExprHasNoAddress) n.typ = makePtrType(c, n.sons[0].typ) of nkHiddenAddr, nkHiddenDeref: checkSonsLen(n, 1) @@ -1994,7 +1994,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = of nkVarSection: result = semVarOrLet(c, n, skVar) of nkLetSection: result = semVarOrLet(c, n, skLet) of nkConstSection: result = semConst(c, n) - of nkTypeSection: result = SemTypeSection(c, n) + of nkTypeSection: result = semTypeSection(c, n) of nkDiscardStmt: result = semDiscard(c, n) of nkWhileStmt: result = semWhile(c, n) of nkTryStmt: result = semTry(c, n) @@ -2013,25 +2013,25 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = of nkMacroDef: result = semMacroDef(c, n) of nkTemplateDef: result = semTemplateDef(c, n) of nkImportStmt: - if not isTopLevel(c): LocalError(n.info, errXOnlyAtModuleScope, "import") + if not isTopLevel(c): localError(n.info, errXOnlyAtModuleScope, "import") result = evalImport(c, n) of nkImportExceptStmt: - if not isTopLevel(c): LocalError(n.info, errXOnlyAtModuleScope, "import") + if not isTopLevel(c): localError(n.info, errXOnlyAtModuleScope, "import") result = evalImportExcept(c, n) of nkFromStmt: - if not isTopLevel(c): LocalError(n.info, errXOnlyAtModuleScope, "from") + if not isTopLevel(c): localError(n.info, errXOnlyAtModuleScope, "from") result = evalFrom(c, n) of nkIncludeStmt: - if not isTopLevel(c): LocalError(n.info, errXOnlyAtModuleScope, "include") + if not isTopLevel(c): localError(n.info, errXOnlyAtModuleScope, "include") result = evalInclude(c, n) of nkExportStmt, nkExportExceptStmt: - if not isTopLevel(c): LocalError(n.info, errXOnlyAtModuleScope, "export") + if not isTopLevel(c): localError(n.info, errXOnlyAtModuleScope, "export") result = semExport(c, n) of nkPragmaBlock: result = semPragmaBlock(c, n) of nkStaticStmt: result = semStaticStmt(c, n) else: - LocalError(n.info, errInvalidExpressionX, + localError(n.info, errInvalidExpressionX, renderTree(n, {renderNoComments})) if result != nil: incl(result.flags, nfSem) |