diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-08-17 19:02:01 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-08-17 19:02:01 +0800 |
commit | e8e5e00ff910bbbd7729d473198eff92e7581e64 (patch) | |
tree | bbc8adf49ed195219acb6df53dad783487889762 /script-beta/core/diagnostics | |
parent | 3e4411e10f8c0ebd10341450edd6c868866d04cb (diff) | |
download | lua-language-server-e8e5e00ff910bbbd7729d473198eff92e7581e64.zip |
优化性能
Diffstat (limited to 'script-beta/core/diagnostics')
-rw-r--r-- | script-beta/core/diagnostics/redundant-parameter.lua | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/script-beta/core/diagnostics/redundant-parameter.lua b/script-beta/core/diagnostics/redundant-parameter.lua index b424c2bf..acb6f63c 100644 --- a/script-beta/core/diagnostics/redundant-parameter.lua +++ b/script-beta/core/diagnostics/redundant-parameter.lua @@ -65,10 +65,11 @@ return function (uri, callback) if not vm.hasType(func, 'function') then return end - local values = vm.getInfers(func) - for _, value in ipairs(values) do - if value.type and value.source.type == 'function' then - local args = countFuncArgs(value.source) + 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 not funcArgs or args > funcArgs then funcArgs = args end |