summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-06-18 19:16:58 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-06-18 19:16:58 +0800
commit32cddbd58e15ae8b0da84b6699cc542daa8ed459 (patch)
tree916e2a0ed11bae8e01574fe5e89eb4151fa4f223 /script/vm
parent805d1c96d07c42a6247b1408395d87df763139c1 (diff)
downloadlua-language-server-32cddbd58e15ae8b0da84b6699cc542daa8ed459.zip
improve
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/getDocs.lua12
-rw-r--r--script/vm/getGlobals.lua9
2 files changed, 9 insertions, 12 deletions
diff --git a/script/vm/getDocs.lua b/script/vm/getDocs.lua
index a17a89d2..a354e214 100644
--- a/script/vm/getDocs.lua
+++ b/script/vm/getDocs.lua
@@ -18,14 +18,12 @@ function vm.getDocDefines(name)
local results = {}
local id = 'def:dn:' .. name
for node in collector.each(id) do
- if node.sources then
- for _, source in ipairs(node.sources) do
- if source.type == 'doc.class.name'
- or source.type == 'doc.alias.name' then
- results[#results+1] = source
- end
+ noder.eachSource(node, function (source)
+ if source.type == 'doc.class.name'
+ or source.type == 'doc.alias.name' then
+ results[#results+1] = source
end
- end
+ end)
end
cache[name] = results
return results
diff --git a/script/vm/getGlobals.lua b/script/vm/getGlobals.lua
index 51cfe1ac..abc765cb 100644
--- a/script/vm/getGlobals.lua
+++ b/script/vm/getGlobals.lua
@@ -1,5 +1,6 @@
local collector = require 'core.collector'
local vm = require 'vm.vm'
+local noder = require 'core.noder'
function vm.hasGlobalSets(name)
local id = ('def:g:%q'):format(name)
@@ -20,11 +21,9 @@ function vm.getGlobalSets(name)
id = ('def:g:%q'):format(name)
end
for node in collector.each(id) do
- if node.sources then
- for _, source in ipairs(node.sources) do
- results[#results+1] = source
- end
- end
+ noder.eachSource(node, function (source)
+ results[#results+1] = source
+ end)
end
return results
end