summaryrefslogtreecommitdiff
path: root/script/core/infer.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-11-16 15:05:49 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-11-16 15:05:49 +0800
commit4c636f0c792fb7abcdf4d38430be23d8bfc40491 (patch)
treef9105a3e2b1cc3035f6c8ddab3682cd91d70bacf /script/core/infer.lua
parentaa100883142d9512fc9e1de5832c72a3cda0bdfe (diff)
downloadlua-language-server-4c636f0c792fb7abcdf4d38430be23d8bfc40491.zip
update type-infer
Diffstat (limited to 'script/core/infer.lua')
-rw-r--r--script/core/infer.lua22
1 files changed, 10 insertions, 12 deletions
diff --git a/script/core/infer.lua b/script/core/infer.lua
index 36bf740d..8da35289 100644
--- a/script/core/infer.lua
+++ b/script/core/infer.lua
@@ -478,6 +478,10 @@ function m.searchInfers(source, field, mark)
if not source then
return nil
end
+ if source.type == 'setlocal'
+ or source.type == 'getlocal' then
+ source = source.node
+ end
local suc, infers = getCachedInfers(source, field)
if suc then
return infers
@@ -487,22 +491,16 @@ function m.searchInfers(source, field, mark)
mark = mark or {}
if not field then
searchInfer(source, infers, mark)
- local id = noder.getID(source)
- if id then
- local noders = noder.getNoders(source)
- for src in noder.eachSource(noders, id) do
- searchInfer(src, infers, mark)
- end
- end
- if source.type == 'field' or source.type == 'method' then
- searchInfer(source.parent, infers, mark)
- end
end
for _, def in ipairs(defs) do
if def.typeGeneric and not isParam then
- else
- searchInfer(def, infers, mark)
+ goto CONTINUE
+ end
+ if def.type == 'setlocal' then
+ goto CONTINUE
end
+ searchInfer(def, infers, mark)
+ ::CONTINUE::
end
if source.type == 'doc.type' then
for _, def in ipairs(source.types) do