diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-11-16 15:05:49 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-11-18 17:10:01 +0800 |
commit | 681a815fb2492a5cdc443ef150f5c5cdccedcf2f (patch) | |
tree | f2c32ebbd962ba43dc0632743b3f15f1850d272c /script | |
parent | 9fbcebbad7861dc842937d88b86d3f6e7039f9d7 (diff) | |
download | lua-language-server-681a815fb2492a5cdc443ef150f5c5cdccedcf2f.zip |
update type-infer
Diffstat (limited to 'script')
-rw-r--r-- | script/core/infer.lua | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/script/core/infer.lua b/script/core/infer.lua index 6e667e65..2825578e 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 |