diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-10-25 19:56:25 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-10-25 19:56:25 +0800 |
commit | 8d88695d3897384cdee001f49b702a1a3586597b (patch) | |
tree | c42d0dee6f7762603c4d84bc65629835fdb6c8c8 /script-beta/parser | |
parent | 7e6bb85af1ffccc01f7504cd427fc8123d3179d0 (diff) | |
download | lua-language-server-8d88695d3897384cdee001f49b702a1a3586597b.zip |
更新
Diffstat (limited to 'script-beta/parser')
-rw-r--r-- | script-beta/parser/guide.lua | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 976ccd1e..0e79fb08 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -2514,6 +2514,21 @@ function m.getDocTypeNames(doc) end function m.inferByDoc(status, source) + while source.type == 'select' or source.type == 'call' do + local parent = source.parent + if parent.type == 'local' + or parent.type == 'setlocal' + or parent.type == 'setglobal' + or parent.type == 'setfield' + or parent.type == 'setmethod' + or parent.type == 'setindex' + or parent.type == 'tablefield' + or parent.type == 'tableindex' then + source = parent + else + break + end + end local binds = source.bindDocs if not binds then return @@ -3222,8 +3237,7 @@ function m.searchInfer(status, obj) status.cache.clock = status.cache.clock or osClock() end - local checked = m.inferByDoc(status, obj) - or m.inferCheckLibrary(status, obj) + local checked = m.inferCheckLibrary(status, obj) or m.inferCheckLiteral(status, obj) or m.inferCheckUnary(status, obj) or m.inferCheckBinary(status, obj) @@ -3235,6 +3249,7 @@ function m.searchInfer(status, obj) return end + m.inferByDoc(status, obj) if not status.simple then m.inferByDef(status, obj) end |