diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-11-04 19:56:00 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-11-04 19:56:00 +0800 |
commit | 6376ac1a2d98280304221243b00a1bc8cac74dc3 (patch) | |
tree | 322c909f4946978a39dd30e99b7a52269eb20df1 /server-beta/src/searcher/eachGlobal.lua | |
parent | 521feda953a686ad876186366391340f945ca65b (diff) | |
download | lua-language-server-6376ac1a2d98280304221243b00a1bc8cac74dc3.zip |
诊断未定义全局变量
Diffstat (limited to 'server-beta/src/searcher/eachGlobal.lua')
-rw-r--r-- | server-beta/src/searcher/eachGlobal.lua | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/server-beta/src/searcher/eachGlobal.lua b/server-beta/src/searcher/eachGlobal.lua index 21ee2c51..49396b00 100644 --- a/server-beta/src/searcher/eachGlobal.lua +++ b/server-beta/src/searcher/eachGlobal.lua @@ -8,10 +8,6 @@ local function eachGlobal(source, callback) end function searcher.eachGlobal(source, callback) - local lock <close> = searcher.lock('eachGlobal', source) - if not lock then - return - end local cache = searcher.cache.eachGlobal[source] if cache then for i = 1, #cache do @@ -19,6 +15,10 @@ function searcher.eachGlobal(source, callback) end return end + local unlock = searcher.lock('eachGlobal', source) + if not unlock then + return + end cache = {} searcher.cache.eachGlobal[source] = cache local mark = {} @@ -29,6 +29,9 @@ function searcher.eachGlobal(source, callback) end mark[src] = true cache[#cache+1] = info - callback(info) end) + unlock() + for i = 1, #cache do + callback(cache[i]) + end end |