diff options
Diffstat (limited to 'server-beta/src/core')
-rw-r--r-- | server-beta/src/core/diagnostics/unused-function.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/server-beta/src/core/diagnostics/unused-function.lua b/server-beta/src/core/diagnostics/unused-function.lua index eb6b8f7f..ca3a751d 100644 --- a/server-beta/src/core/diagnostics/unused-function.lua +++ b/server-beta/src/core/diagnostics/unused-function.lua @@ -10,7 +10,17 @@ return function (uri, callback) if not ast then return end + -- 只检查局部函数与全局函数 guide.eachSourceType(ast.ast, 'function', function (source) + local parent = source.parent + if not parent then + return + end + if parent.type ~= 'local' + and parent.type ~= 'setlocal' + and parent.type ~= 'setglobal' then + return + end local hasSet local hasGet = searcher.eachRef(source, function (info) if info.mode == 'get' then |