diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-01-09 15:27:11 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-01-09 15:27:11 +0800 |
commit | c305b20e2f3b9ea9add39a2f1064ed41a257f6e0 (patch) | |
tree | 272a7534efe17711aa5ca07293c23073fd0dd929 /script-beta/core | |
parent | ab77d10c858c41789bdcde9f82131e38c21904e0 (diff) | |
download | lua-language-server-c305b20e2f3b9ea9add39a2f1064ed41a257f6e0.zip |
通过value来判断function
Diffstat (limited to 'script-beta/core')
-rw-r--r-- | script-beta/core/diagnostics/redundant-parameter.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/script-beta/core/diagnostics/redundant-parameter.lua b/script-beta/core/diagnostics/redundant-parameter.lua index 45f8327e..d619ba10 100644 --- a/script-beta/core/diagnostics/redundant-parameter.lua +++ b/script-beta/core/diagnostics/redundant-parameter.lua @@ -62,14 +62,18 @@ return function (uri, callback) local func = source.node local funcArgs - vm.eachDef(func, function (src) - if src.type == 'function' then - local args = countFuncArgs(src) + if not vm.hasType(func, 'function') then + return + end + local values = vm.getValue(func) + for _, value in ipairs(values) do + if value.type and value.source.type == 'function' then + local args = countFuncArgs(value.source) if not funcArgs or args > funcArgs then funcArgs = args end end - end) + end funcArgs = funcArgs or countLibraryArgs(func) if not funcArgs then |