summaryrefslogtreecommitdiff
path: root/server-beta/src/core/diagnostics/unused-function.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-22 23:26:32 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-22 23:26:32 +0800
commitd0ff66c9abe9d6abbca12fd811e0c3cb69c1033a (patch)
treebb34518d70b85de7656dbdbe958dfa221a3ff3b3 /server-beta/src/core/diagnostics/unused-function.lua
parent0a2c2ad15e1ec359171fb0dd4c72e57c5b66e9ba (diff)
downloadlua-language-server-d0ff66c9abe9d6abbca12fd811e0c3cb69c1033a.zip
整理一下目录结构
Diffstat (limited to 'server-beta/src/core/diagnostics/unused-function.lua')
-rw-r--r--server-beta/src/core/diagnostics/unused-function.lua45
1 files changed, 0 insertions, 45 deletions
diff --git a/server-beta/src/core/diagnostics/unused-function.lua b/server-beta/src/core/diagnostics/unused-function.lua
deleted file mode 100644
index 6c53cdf7..00000000
--- a/server-beta/src/core/diagnostics/unused-function.lua
+++ /dev/null
@@ -1,45 +0,0 @@
-local files = require 'files'
-local guide = require 'parser.guide'
-local vm = require 'vm'
-local define = require 'proto.define'
-local lang = require 'language'
-local await = require 'await'
-
-return function (uri, callback)
- local ast = files.getAst(uri)
- 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 = vm.eachRef(source, function (info)
- if info.mode == 'get' then
- return true
- elseif info.mode == 'set'
- or info.mode == 'declare' then
- hasSet = true
- end
- end)
- if not hasGet and hasSet then
- callback {
- start = source.start,
- finish = source.finish,
- tags = { define.DiagnosticTag.Unnecessary },
- message = lang.script.DIAG_UNUSED_FUNCTION,
- }
- end
- await.delay(function ()
- return files.globalVersion
- end)
- end)
-end