diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-06-24 19:57:37 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-06-24 19:57:37 +0800 |
commit | bc0270a06a1017301ca96712b350c399537e63a6 (patch) | |
tree | 968c8c12d95f5b123d802a1dfc02b6befab9c1b0 /script/core/searcher.lua | |
parent | 2a3f40432c1e6de9f40e9fd9c222a95fa7ad4317 (diff) | |
download | lua-language-server-bc0270a06a1017301ca96712b350c399537e63a6.zip |
cleanup
Diffstat (limited to 'script/core/searcher.lua')
-rw-r--r-- | script/core/searcher.lua | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/script/core/searcher.lua b/script/core/searcher.lua index effbdab4..f86deddf 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -441,9 +441,9 @@ function m.searchRefsByID(status, uri, expect, mode) end local function checkForward(id, node, field) - noder.eachForward(node, function (forwardID, tag) + for forwardID, tag in noder.eachForward(node) do if not checkThenPushTag('forward', tag) then - return + goto CONTINUE end local targetUri, targetID = noder.getUriAndID(forwardID) if targetUri and not files.eq(targetUri, uri) then @@ -452,7 +452,8 @@ function m.searchRefsByID(status, uri, expect, mode) searchID(targetID or forwardID, field) end popTag('forward', tag) - end) + ::CONTINUE:: + end end local function checkBackward(id, node, field) @@ -462,12 +463,12 @@ function m.searchRefsByID(status, uri, expect, mode) if ignoredIDs[id] then return end - noder.eachBackward(node, function (backwardID, tag) + for backwardID, tag in noder.eachBackward(node) do if tag == 'deep' and mode ~= 'allref' and mode ~= 'alldef' then - return + goto CONTINUE end if not checkThenPushTag('backward', tag) then - return + goto CONTINUE end local targetUri, targetID = noder.getUriAndID(backwardID) if targetUri and not files.eq(targetUri, uri) then @@ -476,7 +477,8 @@ function m.searchRefsByID(status, uri, expect, mode) searchID(targetID or backwardID, field) end popTag('backward', tag) - end) + ::CONTINUE:: + end end local function checkSpecial(id, field) @@ -580,10 +582,10 @@ function m.searchRefsByID(status, uri, expect, mode) callStack[#callStack+1] = node.call end if field == nil and node.source and not ignoredSources[id] then - noder.eachSource(node, function (source) + for source in noder.eachSource(node) do local force = genericCallArgs[source] m.pushResult(status, mode, source, force) - end) + end end if node.require then @@ -771,9 +773,9 @@ local function searchAllGlobalByUri(status, mode, uri, fullID) for id, node in pairs(noders) do if node.source and id == fullID then - noder.eachSource(node, function (source) + for source in noder.eachSource(node) do m.pushResult(status, mode, source) - end) + end end end else @@ -781,9 +783,9 @@ local function searchAllGlobalByUri(status, mode, uri, fullID) if node.source and id:sub(1, 2) == 'g:' and not id:find(noder.SPLIT_CHAR) then - noder.eachSource(node, function (source) + for source in noder.eachSource(node) do m.pushResult(status, mode, source) - end) + end end end end |