diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-10-26 20:01:34 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-10-26 20:01:34 +0800 |
commit | 0b708180509007bfb6c54d8112f85d5f85ec9210 (patch) | |
tree | 75bc64987a806becaea9bcebeb6227d8b30e944c /script-beta/parser | |
parent | f373707516e5edf9b7a35a8cb5a5e66b7bd63da6 (diff) | |
download | lua-language-server-0b708180509007bfb6c54d8112f85d5f85ec9210.zip |
array 类
Diffstat (limited to 'script-beta/parser')
-rw-r--r-- | script-beta/parser/guide.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 0decb789..4c18a695 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -2661,6 +2661,30 @@ function m.inferCheckUpDoc(status, source) end end +function m.inferCheckFieldDoc(status, source) + -- 检查 string[] 的情况 + if source.type == 'getindex' then + local node = source.node + if not node then + return + end + local newStatus = m.status(status) + m.searchInfer(newStatus, node) + local ok + for _, infer in ipairs(newStatus.results) do + local src = infer.source + if src.array then + ok = true + status.results[#status.results+1] = { + type = infer.type:gsub('%[%]$', ''), + source = source, + } + end + end + return ok + end +end + function m.inferCheckUnary(status, source) if source.type ~= 'unary' then return @@ -3400,6 +3424,7 @@ function m.searchInfer(status, obj) local checked = m.inferCheckDoc(status, obj) or m.inferCheckUpDoc(status, obj) + or m.inferCheckFieldDoc(status, obj) or m.inferCheckLibrary(status, obj) or m.inferCheckLiteral(status, obj) or m.inferCheckUnary(status, obj) |