diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-11-10 17:58:48 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-11-10 17:58:48 +0800 |
commit | fe53e824366b7f035b22d3dfac1c886f01e7044c (patch) | |
tree | 7f8622e0df0387885c6e61755a6f7ceb2f288ae3 /server-beta/src/searcher/eachRef.lua | |
parent | 96955fce58180eb5bf86d11747f7712bbefbcf62 (diff) | |
download | lua-language-server-fe53e824366b7f035b22d3dfac1c886f01e7044c.zip |
优化全局变量性能
Diffstat (limited to 'server-beta/src/searcher/eachRef.lua')
-rw-r--r-- | server-beta/src/searcher/eachRef.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/server-beta/src/searcher/eachRef.lua b/server-beta/src/searcher/eachRef.lua index b59143ad..e6540b7a 100644 --- a/server-beta/src/searcher/eachRef.lua +++ b/server-beta/src/searcher/eachRef.lua @@ -368,7 +368,10 @@ function searcher.eachRef(source, callback) local cache = searcher.cache.eachRef[source] if cache then for i = 1, #cache do - callback(cache[i]) + local res = callback(cache[i]) + if res ~= nil then + return res + end end return end @@ -393,6 +396,9 @@ function searcher.eachRef(source, callback) searcher.cache.eachRef[src] = cache end for i = 1, #cache do - callback(cache[i]) + local res = callback(cache[i]) + if res ~= nil then + return res + end end end |