summaryrefslogtreecommitdiff
path: root/script-beta/core/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-08-17 19:02:01 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-08-17 19:02:01 +0800
commite8e5e00ff910bbbd7729d473198eff92e7581e64 (patch)
treebbc8adf49ed195219acb6df53dad783487889762 /script-beta/core/diagnostics
parent3e4411e10f8c0ebd10341450edd6c868866d04cb (diff)
downloadlua-language-server-e8e5e00ff910bbbd7729d473198eff92e7581e64.zip
优化性能
Diffstat (limited to 'script-beta/core/diagnostics')
-rw-r--r--script-beta/core/diagnostics/redundant-parameter.lua9
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