summaryrefslogtreecommitdiff
path: root/server-beta/src/searcher/getGlobals.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-20 11:00:32 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-20 11:00:32 +0800
commit03a56a63e1c943e985b73082be34749a3bd5533b (patch)
tree543dcf81e70b0ff429dcd7415f811ae803f994ab /server-beta/src/searcher/getGlobals.lua
parent2c90cf1b7b1fce9095f95bc54ed33680c848bfbe (diff)
downloadlua-language-server-03a56a63e1c943e985b73082be34749a3bd5533b.zip
searcher太难拼了,我们还是叫vm吧
Diffstat (limited to 'server-beta/src/searcher/getGlobals.lua')
-rw-r--r--server-beta/src/searcher/getGlobals.lua45
1 files changed, 0 insertions, 45 deletions
diff --git a/server-beta/src/searcher/getGlobals.lua b/server-beta/src/searcher/getGlobals.lua
deleted file mode 100644
index 13e69e16..00000000
--- a/server-beta/src/searcher/getGlobals.lua
+++ /dev/null
@@ -1,45 +0,0 @@
-local guide = require 'parser.guide'
-local searcher = require 'searcher.searcher'
-
-local function getGlobals(root)
- local env = guide.getENV(root)
- local cache = {}
- local mark = {}
- searcher.eachField(env, function (info)
- local src = info.source
- if mark[src] then
- return
- end
- mark[src] = true
- local name = info.key
- if not name then
- return
- end
- if not cache[name] then
- cache[name] = {
- key = name,
- mode = {},
- }
- end
- cache[name][#cache[name]+1] = info
- cache[name].mode[info.mode] = true
- searcher.cache.getGlobal[src] = name
- end)
- return cache
-end
-
-function searcher.getGlobals(source)
- source = guide.getRoot(source)
- local cache = searcher.cache.getGlobals[source]
- if cache ~= nil then
- return cache
- end
- local unlock = searcher.lock('getGlobals', source)
- if not unlock then
- return nil
- end
- cache = getGlobals(source) or false
- searcher.cache.getGlobals[source] = cache
- unlock()
- return cache
-end