more replacements for the deprecated '<'
This commit is contained in:
parent
70ea45cdba
commit
6a3288a60e
19 changed files with 43 additions and 43 deletions
|
|
@ -839,7 +839,7 @@ proc newNilLit*(): NimNode {.compileTime.} =
|
||||||
## New nil literal shortcut
|
## New nil literal shortcut
|
||||||
result = newNimNode(nnkNilLit)
|
result = newNimNode(nnkNilLit)
|
||||||
|
|
||||||
proc last*(node: NimNode): NimNode {.compileTime.} = node[<node.len]
|
proc last*(node: NimNode): NimNode {.compileTime.} = node[node.len-1]
|
||||||
## Return the last item in nodes children. Same as `node[^1]`
|
## Return the last item in nodes children. Same as `node[^1]`
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -283,7 +283,7 @@ proc to*[T](data: string): T =
|
||||||
loadAny(newStringStream(data), toAny(result), tab)
|
loadAny(newStringStream(data), toAny(result), tab)
|
||||||
|
|
||||||
when not defined(testing) and isMainModule:
|
when not defined(testing) and isMainModule:
|
||||||
template testit(x: expr) = echo($$to[type(x)]($$x))
|
template testit(x: untyped) = echo($$to[type(x)]($$x))
|
||||||
|
|
||||||
var x: array[0..4, array[0..4, string]] = [
|
var x: array[0..4, array[0..4, string]] = [
|
||||||
["test", "1", "2", "3", "4"], ["test", "1", "2", "3", "4"],
|
["test", "1", "2", "3", "4"], ["test", "1", "2", "3", "4"],
|
||||||
|
|
|
||||||
|
|
@ -1199,7 +1199,7 @@ proc unindent*(s: string, count: Natural, padding: string = " "): string
|
||||||
var indentCount = 0
|
var indentCount = 0
|
||||||
for j in 0..<count.int:
|
for j in 0..<count.int:
|
||||||
indentCount.inc
|
indentCount.inc
|
||||||
if line[j .. j + <padding.len] != padding:
|
if line[j .. j + padding.len-1] != padding:
|
||||||
indentCount = j
|
indentCount = j
|
||||||
break
|
break
|
||||||
result.add(line[indentCount*padding.len .. ^1])
|
result.add(line[indentCount*padding.len .. ^1])
|
||||||
|
|
|
||||||
|
|
@ -643,9 +643,9 @@ when useMarkForDebug or useBackupGc:
|
||||||
forAllChildren(d, waMarkPrecise)
|
forAllChildren(d, waMarkPrecise)
|
||||||
|
|
||||||
proc markGlobals(gch: var GcHeap) =
|
proc markGlobals(gch: var GcHeap) =
|
||||||
for i in 0 .. < globalMarkersLen: globalMarkers[i]()
|
for i in 0 .. globalMarkersLen-1: globalMarkers[i]()
|
||||||
let d = gch.additionalRoots.d
|
let d = gch.additionalRoots.d
|
||||||
for i in 0 .. < gch.additionalRoots.len: markS(gch, d[i])
|
for i in 0 .. gch.additionalRoots.len-1: markS(gch, d[i])
|
||||||
|
|
||||||
when logGC:
|
when logGC:
|
||||||
var
|
var
|
||||||
|
|
@ -653,7 +653,7 @@ when logGC:
|
||||||
cycleCheckALen = 0
|
cycleCheckALen = 0
|
||||||
|
|
||||||
proc alreadySeen(c: PCell): bool =
|
proc alreadySeen(c: PCell): bool =
|
||||||
for i in 0 .. <cycleCheckALen:
|
for i in 0 .. cycleCheckALen-1:
|
||||||
if cycleCheckA[i] == c: return true
|
if cycleCheckA[i] == c: return true
|
||||||
if cycleCheckALen == len(cycleCheckA):
|
if cycleCheckALen == len(cycleCheckA):
|
||||||
gcAssert(false, "cycle detection overflow")
|
gcAssert(false, "cycle detection overflow")
|
||||||
|
|
|
||||||
|
|
@ -487,12 +487,12 @@ proc GC_dumpHeap*(file: File) =
|
||||||
var spaceIter: ObjectSpaceIter
|
var spaceIter: ObjectSpaceIter
|
||||||
when false:
|
when false:
|
||||||
var d = gch.decStack.d
|
var d = gch.decStack.d
|
||||||
for i in 0 .. < gch.decStack.len:
|
for i in 0 .. gch.decStack.len-1:
|
||||||
if isAllocatedPtr(gch.region, d[i]):
|
if isAllocatedPtr(gch.region, d[i]):
|
||||||
c_fprintf(file, "onstack %p\n", d[i])
|
c_fprintf(file, "onstack %p\n", d[i])
|
||||||
else:
|
else:
|
||||||
c_fprintf(file, "onstack_invalid %p\n", d[i])
|
c_fprintf(file, "onstack_invalid %p\n", d[i])
|
||||||
for i in 0 .. < globalMarkersLen: globalMarkers[i]()
|
for i in 0 .. globalMarkersLen-1: globalMarkers[i]()
|
||||||
while true:
|
while true:
|
||||||
let x = allObjectsAsProc(gch.region, addr spaceIter)
|
let x = allObjectsAsProc(gch.region, addr spaceIter)
|
||||||
if spaceIter.state < 0: break
|
if spaceIter.state < 0: break
|
||||||
|
|
@ -579,7 +579,7 @@ proc markIncremental(gch: var GcHeap): bool =
|
||||||
result = true
|
result = true
|
||||||
|
|
||||||
proc markGlobals(gch: var GcHeap) =
|
proc markGlobals(gch: var GcHeap) =
|
||||||
for i in 0 .. < globalMarkersLen: globalMarkers[i]()
|
for i in 0 .. globalMarkersLen-1: globalMarkers[i]()
|
||||||
|
|
||||||
proc doOperation(p: pointer, op: WalkOp) =
|
proc doOperation(p: pointer, op: WalkOp) =
|
||||||
if p == nil: return
|
if p == nil: return
|
||||||
|
|
|
||||||
|
|
@ -450,9 +450,9 @@ when false:
|
||||||
quit 1
|
quit 1
|
||||||
|
|
||||||
proc markGlobals(gch: var GcHeap) =
|
proc markGlobals(gch: var GcHeap) =
|
||||||
for i in 0 .. < globalMarkersLen: globalMarkers[i]()
|
for i in 0 .. globalMarkersLen-1: globalMarkers[i]()
|
||||||
let d = gch.additionalRoots.d
|
let d = gch.additionalRoots.d
|
||||||
for i in 0 .. < gch.additionalRoots.len: mark(gch, d[i])
|
for i in 0 .. gch.additionalRoots.len-1: mark(gch, d[i])
|
||||||
|
|
||||||
proc gcMark(gch: var GcHeap, p: pointer) {.inline.} =
|
proc gcMark(gch: var GcHeap, p: pointer) {.inline.} =
|
||||||
# the addresses are not as cells on the stack, so turn them to cells:
|
# the addresses are not as cells on the stack, so turn them to cells:
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ proc `$`(x: uint64): string =
|
||||||
|
|
||||||
let half = i div 2
|
let half = i div 2
|
||||||
# Reverse
|
# Reverse
|
||||||
for t in 0 .. < half: swap(result[t], result[i-t-1])
|
for t in 0 .. half-1: swap(result[t], result[i-t-1])
|
||||||
|
|
||||||
proc reprStrAux(result: var string, s: cstring; len: int) =
|
proc reprStrAux(result: var string, s: cstring; len: int) =
|
||||||
if cast[pointer](s) == nil:
|
if cast[pointer](s) == nil:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue