summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/core/searcher.lua41
1 files changed, 5 insertions, 36 deletions
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index dd6234f1..96b5c220 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -25,6 +25,8 @@ local sformat = string.format
local getUri = guide.getUri
local getRoot = guide.getRoot
+local ceach = collector.each
+
local getNoders = noder.getNoders
local getID = noder.getID
local getLastID = noder.getLastID
@@ -237,26 +239,6 @@ function m.getObjectValue(obj)
return nil
end
-local function checkLock(status, k1, k2)
- local locks = status.lock
- local lock1 = locks[k1]
- if not lock1 then
- lock1 = {}
- locks[k1] = lock1
- end
- if lock1[''] then
- return true
- end
- if k2 == nil then
- k2 = ''
- end
- if lock1[k2] then
- return true
- end
- lock1[k2] = true
- return false
-end
-
local strs = {}
local function footprint(status, ...)
if TRACE then
@@ -271,19 +253,6 @@ local function footprint(status, ...)
end
end
-local function crossSearch(status, uri, expect, mode, sourceUri)
- if status.dontCross > 0 then
- return
- end
- if checkLock(status, uri, expect) then
- return
- end
- footprint(status, 'crossSearch', uri, expect)
- m.searchRefsByID(status, uri, expect, mode)
- --status.lock[uri] = nil
- footprint(status, 'crossSearch finish, back to:', sourceUri)
-end
-
local function checkCache(status, uri, expect, mode)
local cache = status.cache
local fileCache = cache[uri]
@@ -794,7 +763,7 @@ function m.searchRefsByID(status, suri, expect, mode)
or mode == 'alldef'
or mode == 'field'
or field then
- for _, guri in collector.each('def:' .. id) do
+ for _, guri in ceach('def:' .. id) do
if uri == guri then
goto CONTINUE
end
@@ -802,7 +771,7 @@ function m.searchRefsByID(status, suri, expect, mode)
::CONTINUE::
end
else
- for _, guri in collector.each(id) do
+ for _, guri in ceach(id) do
if crossed[guri] then
goto CONTINUE
end
@@ -830,7 +799,7 @@ function m.searchRefsByID(status, suri, expect, mode)
or id == 'dn:string' then
sid = 'def:' .. sid
end
- for _, guri in collector.each(sid) do
+ for _, guri in ceach(sid) do
if uri ~= guri then
searchID(guri, id, field, uri)
end