Merge pull request #273 from nim-lang/ARAQ-fix-warnings

fixes a 'break search loop' bug; got rid of most compiler warnings
This commit is contained in:
Dominik Picheta 2016-12-12 20:17:29 +01:00 committed by GitHub
commit 4276b7237d
8 changed files with 30 additions and 34 deletions

View file

@ -141,7 +141,7 @@ proc doDownload*(url: string, downloadDir: string, verRange: VersionRange,
## method.
##
## Returns the version of the repository which has been downloaded.
template getLatestByTag(meth: stmt): stmt {.dirty, immediate.} =
template getLatestByTag(meth: untyped) {.dirty.} =
echo("Found tags...")
# Find latest version that fits our ``verRange``.
var latest = findLatest(verRange, versions)

View file

@ -94,10 +94,10 @@ proc setupVM(module: PSym; scriptName: string,
proc listDirs(a: VmArgs, filter: set[PathComponent]) =
let dir = getString(a, 0)
var result: seq[string] = @[]
var res: seq[string] = @[]
for kind, path in walkDir(dir):
if kind in filter: result.add path
setResult(a, result)
if kind in filter: res.add path
setResult(a, res)
template cbconf(name, body) {.dirty.} =
result.registerCallback "stdlib.system." & astToStr(name),
@ -346,7 +346,7 @@ proc readPackageInfoFromNims*(scriptName: string, options: Options,
elif cmpIgnoreStyle(backend, "javascript") == 0:
result.backend = "js"
else:
result.backend = backend.toLower()
result.backend = backend.toLowerAscii()
# Grab all the global procs
for i in thisModule.tab.data:
@ -395,8 +395,8 @@ proc execHook*(scriptName, actionName: string, before: bool,
result.flags = newStringTable()
compiler_options.command = internalCmd
let hookName =
if before: actionName.toLower & "Before"
else: actionName.toLower & "After"
if before: actionName.toLowerAscii & "Before"
else: actionName.toLowerAscii & "After"
echo("Attempting to execute hook ", hookName, " in ", scriptName)
let thisModule = execScript(scriptName, result.flags, options)

View file

@ -293,11 +293,6 @@ proc parseCmdLine*(): Options =
if result.action.typ == actionNil:
writeHelp()
# TODO: Remove this after a couple of versions.
if getNimrodVersion() > newVersion("0.9.6"):
# Rename deprecated babel dir.
renameBabelToNimble(result)
proc getProxy*(options: Options): Proxy =
## Returns ``nil`` if no proxy is specified.
var url = ""

View file

@ -140,7 +140,7 @@ proc getPackage*(pkg: string, options: Options,
for name, list in options.config.packageLists:
echo("Searching in \"", name, "\" package list...")
let packages = parseFile(options.getNimbleDir() /
"packages_" & name.toLower() & ".json")
"packages_" & name.toLowerAscii() & ".json")
for p in packages:
if normalize(p["name"].str) == normalize(pkg):
resPkg = p.fromJson()
@ -152,7 +152,7 @@ proc getPackageList*(options: Options): seq[Package] =
var namesAdded = initSet[string]()
for name, list in options.config.packageLists:
let packages = parseFile(options.getNimbleDir() /
"packages_" & name.toLower() & ".json")
"packages_" & name.toLowerAscii() & ".json")
for p in packages:
let pkg: Package = p.fromJson()
if pkg.name notin namesAdded:

View file

@ -7,8 +7,7 @@ import version, tools, common, nimscriptsupport, options, packageinfo
## because it depends on ``nimscriptsupport`` (``nimscriptsupport`` also
## depends on other procedures in ``packageinfo``.
when not declared(system.map):
from sequtils import map
from sequtils import apply
type
NimbleFile* = string
@ -105,7 +104,7 @@ proc multiSplit(s: string): seq[string] =
## done no entries are found in the list, the proc returns a sequence with
## the original string as the only entry.
result = split(s, {char(0x0A), char(0x0D), ','})
map(result, proc(x: var string) = x = x.strip())
apply(result, proc(x: var string) = x = x.strip())
for i in countdown(result.len()-1, 0):
if len(result[i]) < 1:
result.del(i)
@ -154,7 +153,7 @@ proc readPackageInfoFromNimble(path: string; result: var PackageInfo) =
for i in ev.value.multiSplit:
result.bin.add(i.addFileExt(ExeExt))
of "backend":
result.backend = ev.value.toLower()
result.backend = ev.value.toLowerAscii()
case result.backend.normalize
of "javascript": result.backend = "js"
else: discard

View file

@ -32,7 +32,7 @@ proc doCmdEx*(cmd: string): tuple[output: TaintedString, exitCode: int] =
raise newException(NimbleError, "'" & bin & "' not in PATH.")
return execCmdEx(cmd)
template cd*(dir: string, body: stmt) =
template cd*(dir: string, body: untyped) =
## Sets the current dir to ``dir``, executes ``body`` and restores the
## previous working dir.
let lastDir = getCurrentDir()

View file

@ -40,11 +40,11 @@ proc newSpecial*(spe: string): Special = return Special(spe)
proc `$`*(ver: Version): string {.borrow.}
proc hash*(ver: Version): THash {.borrow.}
proc hash*(ver: Version): Hash {.borrow.}
proc `$`*(ver: Special): string {.borrow.}
proc hash*(ver: Special): THash {.borrow.}
proc hash*(ver: Special): Hash {.borrow.}
proc `<`*(ver: Version, ver2: Version): bool =
var sVer = string(ver).split('.')
@ -79,7 +79,7 @@ proc `==`*(ver: Version, ver2: Version): bool =
return false
proc `==`*(spe: Special, spe2: Special): bool =
return ($spe).toLower() == ($spe2).toLower()
return ($spe).toLowerAscii() == ($spe2).toLowerAscii()
proc `<=`*(ver: Version, ver2: Version): bool =
return (ver == ver2) or (ver < ver2)