get rid of deprecated toLower/toUpper

This commit is contained in:
Andreas Rumpf
2016-07-19 19:28:01 +02:00
parent dc4b2c920c
commit 9605435f2e
8 changed files with 16 additions and 15 deletions

View File

@@ -25,8 +25,9 @@ proc isKeyword(w: PIdent): bool =
proc mangleField(name: PIdent): string =
result = mangle(name.s)
if isKeyword(name):
result[0] = result[0].toUpper # Mangling makes everything lowercase,
# but some identifiers are C keywords
result[0] = result[0].toUpperAscii
# Mangling makes everything lowercase,
# but some identifiers are C keywords
proc hashOwner(s: PSym): FilenameHash =
var m = s

View File

@@ -188,7 +188,7 @@ proc mangle*(name: string): string =
let c = name[i]
case c
of 'A'..'Z':
add(result, c.toLower)
add(result, c.toLowerAscii)
of '_':
discard
of 'a'..'z', '0'..'9':

View File

@@ -66,7 +66,7 @@ proc beautifyName(s: string, k: TSymKind): string =
]:
result.add s[i]
else:
result.add toUpper(s[i])
result.add toUpperAscii(s[i])
of skConst, skEnumField:
# for 'const' we keep how it's spelt; either upper case or lower case:
result.add s[0]
@@ -74,7 +74,7 @@ proc beautifyName(s: string, k: TSymKind): string =
# as a special rule, don't transform 'L' to 'l'
if s.len == 1 and s[0] == 'L': result.add 'L'
elif '_' in s: result.add(s[i])
else: result.add toLower(s[0])
else: result.add toLowerAscii(s[0])
inc i
while i < s.len:
if s[i] == '_':
@@ -85,9 +85,9 @@ proc beautifyName(s: string, k: TSymKind): string =
result.add s[i]
else:
inc i
result.add toUpper(s[i])
result.add toUpperAscii(s[i])
elif allUpper:
result.add toLower(s[i])
result.add toLowerAscii(s[i])
else:
result.add s[i]
inc i

View File

@@ -220,7 +220,7 @@ proc setDefaultLibpath*() =
libpath = parentNimLibPath
proc canonicalizePath*(path: string): string =
when not FileSystemCaseSensitive: result = path.expandFilename.toLower
when not FileSystemCaseSensitive: result = path.expandFilename.toLowerAscii
else: result = path.expandFilename
proc shortenDir*(dir: string): string =
@@ -340,11 +340,11 @@ proc findFile*(f: string): string {.procvar.} =
else:
result = f.rawFindFile
if result.len == 0:
result = f.toLower.rawFindFile
result = f.toLowerAscii.rawFindFile
if result.len == 0:
result = f.rawFindFile2
if result.len == 0:
result = f.toLower.rawFindFile2
result = f.toLowerAscii.rawFindFile2
patchModule()
proc findModule*(modulename, currentModule: string): string =

View File

@@ -164,7 +164,7 @@ proc newSymS(kind: TSymKind, n: PNode, c: PContext): PSym =
result = newSym(kind, considerQuotedIdent(n), getCurrOwner(), n.info)
proc newSymG*(kind: TSymKind, n: PNode, c: PContext): PSym =
proc `$`(kind: TSymKind): string = substr(system.`$`(kind), 2).toLower
proc `$`(kind: TSymKind): string = substr(system.`$`(kind), 2).toLowerAscii
# like newSymS, but considers gensym'ed symbols
if n.kind == nkSym:

View File

@@ -635,8 +635,8 @@ proc getConstExpr(m: PSym, n: PNode): PNode =
of mCompileDate: result = newStrNodeT(times.getDateStr(), n)
of mCompileTime: result = newStrNodeT(times.getClockStr(), n)
of mCpuEndian: result = newIntNodeT(ord(CPU[targetCPU].endian), n)
of mHostOS: result = newStrNodeT(toLower(platform.OS[targetOS].name), n)
of mHostCPU: result = newStrNodeT(platform.CPU[targetCPU].name.toLower, n)
of mHostOS: result = newStrNodeT(toLowerAscii(platform.OS[targetOS].name), n)
of mHostCPU: result = newStrNodeT(platform.CPU[targetCPU].name.toLowerAscii, n)
of mAppType: result = getAppType(n)
of mNaN: result = newFloatNodeT(NaN, n)
of mInf: result = newFloatNodeT(Inf, n)

View File

@@ -454,7 +454,7 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
typ = skipIntLit(def.typ)
if hasEmpty(typ):
localError(def.info, errCannotInferTypeOfTheLiteral,
($typ.kind).substr(2).toLower)
($typ.kind).substr(2).toLowerAscii)
else:
def = ast.emptyNode
if symkind == skLet: localError(a.info, errLetNeedsInit)

View File

@@ -1038,7 +1038,7 @@ proc semGenericParamInInvocation(c: PContext, n: PNode): PType =
proc semGeneric(c: PContext, n: PNode, s: PSym, prev: PType): PType =
if s.typ == nil:
localError(n.info, "cannot instantiate the '$1' $2" %
[s.name.s, ($s.kind).substr(2).toLower])
[s.name.s, ($s.kind).substr(2).toLowerAscii])
return newOrPrevType(tyError, prev, c)
var t = s.typ