get rid of deprecated toLower/toUpper
This commit is contained in:
parent
dc4b2c920c
commit
9605435f2e
8 changed files with 16 additions and 15 deletions
|
|
@ -25,7 +25,8 @@ proc isKeyword(w: PIdent): bool =
|
||||||
proc mangleField(name: PIdent): string =
|
proc mangleField(name: PIdent): string =
|
||||||
result = mangle(name.s)
|
result = mangle(name.s)
|
||||||
if isKeyword(name):
|
if isKeyword(name):
|
||||||
result[0] = result[0].toUpper # Mangling makes everything lowercase,
|
result[0] = result[0].toUpperAscii
|
||||||
|
# Mangling makes everything lowercase,
|
||||||
# but some identifiers are C keywords
|
# but some identifiers are C keywords
|
||||||
|
|
||||||
proc hashOwner(s: PSym): FilenameHash =
|
proc hashOwner(s: PSym): FilenameHash =
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ proc mangle*(name: string): string =
|
||||||
let c = name[i]
|
let c = name[i]
|
||||||
case c
|
case c
|
||||||
of 'A'..'Z':
|
of 'A'..'Z':
|
||||||
add(result, c.toLower)
|
add(result, c.toLowerAscii)
|
||||||
of '_':
|
of '_':
|
||||||
discard
|
discard
|
||||||
of 'a'..'z', '0'..'9':
|
of 'a'..'z', '0'..'9':
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ proc beautifyName(s: string, k: TSymKind): string =
|
||||||
]:
|
]:
|
||||||
result.add s[i]
|
result.add s[i]
|
||||||
else:
|
else:
|
||||||
result.add toUpper(s[i])
|
result.add toUpperAscii(s[i])
|
||||||
of skConst, skEnumField:
|
of skConst, skEnumField:
|
||||||
# for 'const' we keep how it's spelt; either upper case or lower case:
|
# for 'const' we keep how it's spelt; either upper case or lower case:
|
||||||
result.add s[0]
|
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'
|
# as a special rule, don't transform 'L' to 'l'
|
||||||
if s.len == 1 and s[0] == 'L': result.add 'L'
|
if s.len == 1 and s[0] == 'L': result.add 'L'
|
||||||
elif '_' in s: result.add(s[i])
|
elif '_' in s: result.add(s[i])
|
||||||
else: result.add toLower(s[0])
|
else: result.add toLowerAscii(s[0])
|
||||||
inc i
|
inc i
|
||||||
while i < s.len:
|
while i < s.len:
|
||||||
if s[i] == '_':
|
if s[i] == '_':
|
||||||
|
|
@ -85,9 +85,9 @@ proc beautifyName(s: string, k: TSymKind): string =
|
||||||
result.add s[i]
|
result.add s[i]
|
||||||
else:
|
else:
|
||||||
inc i
|
inc i
|
||||||
result.add toUpper(s[i])
|
result.add toUpperAscii(s[i])
|
||||||
elif allUpper:
|
elif allUpper:
|
||||||
result.add toLower(s[i])
|
result.add toLowerAscii(s[i])
|
||||||
else:
|
else:
|
||||||
result.add s[i]
|
result.add s[i]
|
||||||
inc i
|
inc i
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ proc setDefaultLibpath*() =
|
||||||
libpath = parentNimLibPath
|
libpath = parentNimLibPath
|
||||||
|
|
||||||
proc canonicalizePath*(path: string): string =
|
proc canonicalizePath*(path: string): string =
|
||||||
when not FileSystemCaseSensitive: result = path.expandFilename.toLower
|
when not FileSystemCaseSensitive: result = path.expandFilename.toLowerAscii
|
||||||
else: result = path.expandFilename
|
else: result = path.expandFilename
|
||||||
|
|
||||||
proc shortenDir*(dir: string): string =
|
proc shortenDir*(dir: string): string =
|
||||||
|
|
@ -340,11 +340,11 @@ proc findFile*(f: string): string {.procvar.} =
|
||||||
else:
|
else:
|
||||||
result = f.rawFindFile
|
result = f.rawFindFile
|
||||||
if result.len == 0:
|
if result.len == 0:
|
||||||
result = f.toLower.rawFindFile
|
result = f.toLowerAscii.rawFindFile
|
||||||
if result.len == 0:
|
if result.len == 0:
|
||||||
result = f.rawFindFile2
|
result = f.rawFindFile2
|
||||||
if result.len == 0:
|
if result.len == 0:
|
||||||
result = f.toLower.rawFindFile2
|
result = f.toLowerAscii.rawFindFile2
|
||||||
patchModule()
|
patchModule()
|
||||||
|
|
||||||
proc findModule*(modulename, currentModule: string): string =
|
proc findModule*(modulename, currentModule: string): string =
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ proc newSymS(kind: TSymKind, n: PNode, c: PContext): PSym =
|
||||||
result = newSym(kind, considerQuotedIdent(n), getCurrOwner(), n.info)
|
result = newSym(kind, considerQuotedIdent(n), getCurrOwner(), n.info)
|
||||||
|
|
||||||
proc newSymG*(kind: TSymKind, n: PNode, c: PContext): PSym =
|
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
|
# like newSymS, but considers gensym'ed symbols
|
||||||
if n.kind == nkSym:
|
if n.kind == nkSym:
|
||||||
|
|
|
||||||
|
|
@ -635,8 +635,8 @@ proc getConstExpr(m: PSym, n: PNode): PNode =
|
||||||
of mCompileDate: result = newStrNodeT(times.getDateStr(), n)
|
of mCompileDate: result = newStrNodeT(times.getDateStr(), n)
|
||||||
of mCompileTime: result = newStrNodeT(times.getClockStr(), n)
|
of mCompileTime: result = newStrNodeT(times.getClockStr(), n)
|
||||||
of mCpuEndian: result = newIntNodeT(ord(CPU[targetCPU].endian), n)
|
of mCpuEndian: result = newIntNodeT(ord(CPU[targetCPU].endian), n)
|
||||||
of mHostOS: result = newStrNodeT(toLower(platform.OS[targetOS].name), n)
|
of mHostOS: result = newStrNodeT(toLowerAscii(platform.OS[targetOS].name), n)
|
||||||
of mHostCPU: result = newStrNodeT(platform.CPU[targetCPU].name.toLower, n)
|
of mHostCPU: result = newStrNodeT(platform.CPU[targetCPU].name.toLowerAscii, n)
|
||||||
of mAppType: result = getAppType(n)
|
of mAppType: result = getAppType(n)
|
||||||
of mNaN: result = newFloatNodeT(NaN, n)
|
of mNaN: result = newFloatNodeT(NaN, n)
|
||||||
of mInf: result = newFloatNodeT(Inf, n)
|
of mInf: result = newFloatNodeT(Inf, n)
|
||||||
|
|
|
||||||
|
|
@ -454,7 +454,7 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
|
||||||
typ = skipIntLit(def.typ)
|
typ = skipIntLit(def.typ)
|
||||||
if hasEmpty(typ):
|
if hasEmpty(typ):
|
||||||
localError(def.info, errCannotInferTypeOfTheLiteral,
|
localError(def.info, errCannotInferTypeOfTheLiteral,
|
||||||
($typ.kind).substr(2).toLower)
|
($typ.kind).substr(2).toLowerAscii)
|
||||||
else:
|
else:
|
||||||
def = ast.emptyNode
|
def = ast.emptyNode
|
||||||
if symkind == skLet: localError(a.info, errLetNeedsInit)
|
if symkind == skLet: localError(a.info, errLetNeedsInit)
|
||||||
|
|
|
||||||
|
|
@ -1038,7 +1038,7 @@ proc semGenericParamInInvocation(c: PContext, n: PNode): PType =
|
||||||
proc semGeneric(c: PContext, n: PNode, s: PSym, prev: PType): PType =
|
proc semGeneric(c: PContext, n: PNode, s: PSym, prev: PType): PType =
|
||||||
if s.typ == nil:
|
if s.typ == nil:
|
||||||
localError(n.info, "cannot instantiate the '$1' $2" %
|
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)
|
return newOrPrevType(tyError, prev, c)
|
||||||
|
|
||||||
var t = s.typ
|
var t = s.typ
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue