diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-09-19 10:05:06 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-09-19 10:05:06 +0800 |
commit | 58e4cfe8c2498e676cf60b127f317033242bcd3a (patch) | |
tree | 18d07262d59bc6aca6c235b26ed045901b221779 /script-beta | |
parent | 3f10b39b568295a2f31f3b5bf7f84022dc763f60 (diff) | |
download | lua-language-server-58e4cfe8c2498e676cf60b127f317033242bcd3a.zip |
整理代码
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/core/diagnostics/redundant-parameter.lua | 8 | ||||
-rw-r--r-- | script-beta/parser/guide.lua | 28 |
2 files changed, 21 insertions, 15 deletions
diff --git a/script-beta/core/diagnostics/redundant-parameter.lua b/script-beta/core/diagnostics/redundant-parameter.lua index acb6f63c..ef0f172a 100644 --- a/script-beta/core/diagnostics/redundant-parameter.lua +++ b/script-beta/core/diagnostics/redundant-parameter.lua @@ -62,14 +62,10 @@ return function (uri, callback) local func = source.node local funcArgs - if not vm.hasType(func, 'function') then - return - end local defs = vm.getDefs(func) for _, def in ipairs(defs) do - local value = guide.getObjectValue(def) or def - if value.type == 'function' then - local args = countFuncArgs(value) + if def.type == 'function' then + local args = countFuncArgs(def) if not funcArgs or args > funcArgs then funcArgs = args end diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 13388a34..23cdb444 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -1890,15 +1890,26 @@ function m.cleanResults(results) end --function m.getRefCache(status, obj, mode) --- if not status.interface.cache then +-- local cache = status.interface.cache and status.interface.cache() +-- if not cache then -- return -- end --- if obj.type == 'getglobal' --- or obj.type == 'setglobal' then --- local name = m.getKeyName(obj) --- return status.interface.cache(name, mode, status.index == 1) --- else --- return status.interface.cache(obj, mode, status.index == 1) +-- if m.isGlobal(obj) then +-- obj = m.getKeyName(obj) +-- end +-- if not cache[mode] then +-- cache[mode] = {} +-- end +-- local sourceCache = cache[mode][obj] +-- if sourceCache then +-- return sourceCache +-- end +-- sourceCache = {} +-- cache[mode][obj] = sourceCache +-- return nil, function (results) +-- for i = 1, #results do +-- sourceCache[i] = results[i] +-- end -- end --end @@ -1909,8 +1920,7 @@ function m.getRefCache(status, obj, mode) end cache = status.cache.refCache or {} status.cache.refCache = cache - if obj.type == 'getglobal' - or obj.type == 'setglobal' then + if m.isGlobal(obj) then obj = m.getKeyName(obj) end if not cache[mode] then |