removed compiler internal list implementation (#5371)

This commit is contained in:
Arne Döring 2017-02-22 17:33:12 +01:00 • committed by Andreas Rumpf
commit 92c2a51bf7
25 changed files with 125 additions and 227 deletions

View file

@ -8,7 +8,7 @@
#
import
os, lists, strutils, strtabs, osproc, sets
os, strutils, strtabs, osproc, sets
const
hasTinyCBackend* = defined(tinyc)
@ -129,7 +129,8 @@ var
gExitcode*: int8
gCmd*: TCommands = cmdNone # the command
gSelectedGC* = gcRefc # the selected GC
searchPaths*, lazyPaths*: TLinkedList
searchPaths*: seq[string] = @[]
lazyPaths*: seq[string] = @[]
outFile*: string = ""
docSeeSrcUrl*: string = "" # if empty, no seeSrc will be generated. \
# The string uses the formatting variables `path` and `line`.
@ -267,9 +268,7 @@ proc removeTrailingDirSep*(path: string): string =
proc disableNimblePath*() =
gNoNimblePath = true
lazyPaths.head = nil
lazyPaths.tail = nil
lazyPaths.counter = 0
lazyPaths.setLen(0)
include packagehandling
@ -336,27 +335,22 @@ proc completeGeneratedFilePath*(f: string, createSubDir: bool = true): string =
result = joinPath(subdir, tail)
#echo "completeGeneratedFilePath(", f, ") = ", result
iterator iterSearchPath*(searchPaths: TLinkedList): string =
var it = PStrEntry(searchPaths.head)
while it != nil:
yield it.data
it = PStrEntry(it.next)
proc rawFindFile(f: string): string =
for it in iterSearchPath(searchPaths):
for it in searchPaths:
result = joinPath(it, f)
if existsFile(result):
return result.canonicalizePath
result = ""
proc rawFindFile2(f: string): string =
var it = PStrEntry(lazyPaths.head)
while it != nil:
result = joinPath(it.data, f)
for i, it in lazyPaths:
result = joinPath(it, f)
if existsFile(result):
bringToFront(lazyPaths, it)
# bring to front
for j in countDown(i,1):
swap(lazyPaths[j], lazyPaths[j-1])
return result.canonicalizePath
it = PStrEntry(it.next)
result = ""
template patchModule() {.dirty.} =