'nil' as a statement is deprecated, use an empty 'discard' instead

This commit is contained in:
Araq 2014-01-19 16:54:59 +01:00
commit 73c6efdf66
54 changed files with 170 additions and 170 deletions

View file

@ -73,7 +73,7 @@ proc initGeneralTokenizer*(g: var TGeneralTokenizer, buf: string) =
g.pos = pos
proc deinitGeneralTokenizer*(g: var TGeneralTokenizer) =
nil
discard
proc nimGetKeyword(id: string): TTokenClass =
for k in nimrodKeywords:
@ -102,7 +102,7 @@ proc nimNumberPostfix(g: var TGeneralTokenizer, position: int): int =
if g.buf[pos] in {'0'..'9'}: inc(pos)
if g.buf[pos] in {'0'..'9'}: inc(pos)
else:
nil
discard
result = pos
proc nimNumber(g: var TGeneralTokenizer, position: int): int =

View file

@ -535,7 +535,7 @@ proc match(p: TRstParser, start: int, expr: string): bool =
case p.tok[j].symbol[0]
of 'a'..'z', 'A'..'Z': result = len(p.tok[j].symbol) == 1
of '0'..'9': result = allCharsInSet(p.tok[j].symbol, {'0'..'9'})
else: nil
else: discard
else:
var c = expr[i]
var length = 0
@ -640,7 +640,7 @@ proc parseUrl(p: var TRstParser, father: PRstNode) =
var n = newRstNode(rnStandaloneHyperlink)
while true:
case p.tok[p.idx].kind
of tkWord, tkAdornment, tkOther: nil
of tkWord, tkAdornment, tkOther: discard
of tkPunct:
if p.tok[p.idx+1].kind notin {tkWord, tkAdornment, tkOther, tkPunct}:
break
@ -806,7 +806,7 @@ proc parseInline(p: var TRstParser, father: PRstNode) =
return
add(father, newLeaf(p))
inc(p.idx)
else: nil
else: discard
proc getDirective(p: var TRstParser): string =
if p.tok[p.idx].kind == tkWhite and p.tok[p.idx+1].kind == tkWord:
@ -1339,7 +1339,7 @@ proc parseSection(p: var TRstParser, result: PRstNode) =
of rnDirective: a = parseDotDot(p)
of rnEnumList: a = parseEnumList(p)
of rnLeaf: rstMessage(p, meNewSectionExpected)
of rnParagraph: nil
of rnParagraph: discard
of rnDefList: a = parseDefinitionList(p)
of rnFieldList:
if p.idx > 0: dec(p.idx)
@ -1351,7 +1351,7 @@ proc parseSection(p: var TRstParser, result: PRstNode) =
of rnOptionList: a = parseOptionList(p)
else:
#InternalError("rst.parseSection()")
nil
discard
if a == nil and k != rnDirective:
a = newRstNode(rnParagraph)
parseParagraph(p, a)
@ -1624,7 +1624,7 @@ proc resolveSubs(p: var TRstParser, n: PRstNode): PRstNode =
add(result, n)
add(result, y)
of rnLeaf:
nil
discard
of rnContents:
p.hasToc = true
else:

View file

@ -165,7 +165,7 @@ proc nextSplitPoint*(s: string, start: int): int =
of 'a'..'z':
if result + 1 < len(s) + 0:
if s[result + 1] in {'A'..'Z'}: return
else: nil
else: discard
inc(result)
dec(result) # last valid index

View file

@ -626,7 +626,7 @@ proc len*(n: PJsonNode): int =
case n.kind
of JArray: result = n.elems.len
of JObject: result = n.fields.len
else: nil
else: discard
proc `[]`*(node: PJsonNode, name: string): PJsonNode =
## Gets a field from a `JObject`. Returns nil if the key is not found.
@ -646,6 +646,7 @@ proc hasKey*(node: PJsonNode, key: string): bool =
assert(node.kind == JObject)
for k, item in items(node.fields):
if k == key: return true
proc existsKey*(node: PJsonNode, key: string): bool {.deprecated.} = node.hasKey(key)
## Deprecated for `hasKey`

View file

@ -329,7 +329,7 @@ when defined(Windows) and not defined(useNimRtl):
handle: THandle
atTheEnd: bool
proc hsClose(s: PStream) = nil # nothing to do here
proc hsClose(s: PStream) = discard # nothing to do here
proc hsAtEnd(s: PStream): bool = return PFileHandleStream(s).atTheEnd
proc hsReadData(s: PStream, buffer: pointer, bufLen: int): int =

View file

@ -370,7 +370,7 @@ iterator interpolatedFragments*(s: string): tuple[kind: TInterpolatedKind,
of '\0':
raise newException(EInvalidValue,
"Expected closing '}': " & s[i..s.len])
else: nil
else: discard
inc j
inc i, 2 # skip ${
kind = ikExpr

View file

@ -1523,7 +1523,7 @@ proc skip*(socket: TSocket) {.tags: [FReadIO], deprecated.} =
## **Deprecated since version 0.9.2**: This function is not safe for use.
const bufSize = 1000
var buf = alloc(bufSize)
while recv(socket, buf, bufSize) == bufSize: nil
while recv(socket, buf, bufSize) == bufSize: discard
dealloc(buf)
proc skip*(socket: TSocket, size: int, timeout = -1) =

View file

@ -281,7 +281,7 @@ proc newFileStream*(filename: string, mode: TFileMode): PFileStream =
when true:
nil
discard
else:
type
TFileHandle* = cint ## Operating system file handle

View file

@ -304,7 +304,7 @@ proc countLines*(s: string): int {.noSideEffect,
if s[i+1] == '\l': inc i
inc result
of '\l': inc result
else: nil
else: discard
inc i
proc split*(s: string, seps: set[char] = Whitespace): seq[string] {.

View file

@ -698,7 +698,7 @@ proc format*(info: TTimeInfo, f: string): string =
of "ZZZ":
result.add(info.tzname)
of "":
nil # Do nothing.
discard
else:
raise newException(EInvalidValue, "Invalid format string: " & currentF)

View file

@ -1029,11 +1029,7 @@ when not defined(useNimRtl):
dec(gch.recGcLock)
proc GC_setStrategy(strategy: TGC_Strategy) =
case strategy
of gcThroughput: nil
of gcResponsiveness: nil
of gcOptimizeSpace: nil
of gcOptimizeTime: nil
discard
proc GC_enableMarkAndSweep() =
gch.cycleThreshold = InitialCycleThreshold