summaryrefslogtreecommitdiff
path: root/script/core/diagnostics
diff options
context:
space:
mode:
Diffstat (limited to 'script/core/diagnostics')
-rw-r--r--script/core/diagnostics/ambiguity-1.lua8
-rw-r--r--script/core/diagnostics/circle-doc-class.lua11
-rw-r--r--script/core/diagnostics/close-non-object.lua9
-rw-r--r--script/core/diagnostics/code-after-break.lua10
-rw-r--r--script/core/diagnostics/count-down-loop.lua8
-rw-r--r--script/core/diagnostics/deprecated.lua18
-rw-r--r--script/core/diagnostics/duplicate-doc-class.lua13
-rw-r--r--script/core/diagnostics/duplicate-index.lua12
-rw-r--r--script/core/diagnostics/duplicate-set-field.lua11
-rw-r--r--script/core/diagnostics/empty-block.lua8
-rw-r--r--script/core/diagnostics/global-in-nil-env.lua12
-rw-r--r--script/core/diagnostics/lowercase-global.lua6
-rw-r--r--script/core/diagnostics/newfield-call.lua8
-rw-r--r--script/core/diagnostics/newline-call.lua8
-rw-r--r--script/core/diagnostics/no-implicit-any.lua4
-rw-r--r--script/core/diagnostics/redefined-local.lua6
-rw-r--r--script/core/diagnostics/redundant-parameter.lua4
-rw-r--r--script/core/diagnostics/trailing-space.lua4
-rw-r--r--script/core/diagnostics/unbalanced-assignments.lua4
-rw-r--r--script/core/diagnostics/undefined-doc-class.lua2
-rw-r--r--script/core/diagnostics/undefined-doc-name.lua4
-rw-r--r--script/core/diagnostics/undefined-doc-param.lua2
-rw-r--r--script/core/diagnostics/undefined-env-child.lua6
-rw-r--r--script/core/diagnostics/undefined-field.lua8
-rw-r--r--script/core/diagnostics/undefined-global.lua6
-rw-r--r--script/core/diagnostics/unused-function.lua6
-rw-r--r--script/core/diagnostics/unused-label.lua4
-rw-r--r--script/core/diagnostics/unused-local.lua4
-rw-r--r--script/core/diagnostics/unused-vararg.lua4
29 files changed, 103 insertions, 107 deletions
diff --git a/script/core/diagnostics/ambiguity-1.lua b/script/core/diagnostics/ambiguity-1.lua
index 19bb4f97..0b8385d8 100644
--- a/script/core/diagnostics/ambiguity-1.lua
+++ b/script/core/diagnostics/ambiguity-1.lua
@@ -1,6 +1,6 @@
-local files = require 'files'
-local guide = require 'core.guide'
-local lang = require 'language'
+local files = require 'files'
+local searcher = require 'core.searcher'
+local lang = require 'language'
local opMap = {
['+'] = true,
@@ -30,7 +30,7 @@ return function (uri, callback)
return
end
local text = files.getText(uri)
- guide.eachSourceType(ast.ast, 'binary', function (source)
+ searcher.eachSourceType(ast.ast, 'binary', function (source)
if source.op.type ~= 'or' then
return
end
diff --git a/script/core/diagnostics/circle-doc-class.lua b/script/core/diagnostics/circle-doc-class.lua
index 702cd904..3d32324d 100644
--- a/script/core/diagnostics/circle-doc-class.lua
+++ b/script/core/diagnostics/circle-doc-class.lua
@@ -1,8 +1,7 @@
-local files = require 'files'
-local guide = require 'core.guide'
-local lang = require 'language'
-local define = require 'proto.define'
-local vm = require 'vm'
+local files = require 'files'
+local searcher = require 'core.searcher'
+local lang = require 'language'
+local vm = require 'vm'
return function (uri, callback)
local state = files.getAst(uri)
@@ -19,7 +18,7 @@ return function (uri, callback)
if not doc.extends then
goto CONTINUE
end
- local myName = guide.getKeyName(doc)
+ local myName = searcher.getKeyName(doc)
local list = { doc }
local mark = {}
for i = 1, 999 do
diff --git a/script/core/diagnostics/close-non-object.lua b/script/core/diagnostics/close-non-object.lua
index d1983c42..11c2b820 100644
--- a/script/core/diagnostics/close-non-object.lua
+++ b/script/core/diagnostics/close-non-object.lua
@@ -1,7 +1,6 @@
-local files = require 'files'
-local guide = require 'core.guide'
-local lang = require 'language'
-local define = require 'proto.define'
+local files = require 'files'
+local searcher = require 'core.searcher'
+local lang = require 'language'
return function (uri, callback)
local state = files.getAst(uri)
@@ -9,7 +8,7 @@ return function (uri, callback)
return
end
- guide.eachSourceType(state.ast, 'local', function (source)
+ searcher.eachSourceType(state.ast, 'local', function (source)
if not source.attrs then
return
end
diff --git a/script/core/diagnostics/code-after-break.lua b/script/core/diagnostics/code-after-break.lua
index f23755ea..dc7226ae 100644
--- a/script/core/diagnostics/code-after-break.lua
+++ b/script/core/diagnostics/code-after-break.lua
@@ -1,7 +1,7 @@
-local files = require 'files'
-local guide = require 'core.guide'
-local lang = require 'language'
-local define = require 'proto.define'
+local files = require 'files'
+local searcher = require 'core.searcher'
+local lang = require 'language'
+local define = require 'proto.define'
return function (uri, callback)
local state = files.getAst(uri)
@@ -10,7 +10,7 @@ return function (uri, callback)
end
local mark = {}
- guide.eachSourceType(state.ast, 'break', function (source)
+ searcher.eachSourceType(state.ast, 'break', function (source)
local list = source.parent
if mark[list] then
return
diff --git a/script/core/diagnostics/count-down-loop.lua b/script/core/diagnostics/count-down-loop.lua
index 65099af8..f682ec3c 100644
--- a/script/core/diagnostics/count-down-loop.lua
+++ b/script/core/diagnostics/count-down-loop.lua
@@ -1,6 +1,6 @@
-local files = require "files"
-local guide = require "core.guide"
-local lang = require 'language'
+local files = require "files"
+local searcher = require "core.searcher"
+local lang = require 'language'
return function (uri, callback)
local state = files.getAst(uri)
@@ -9,7 +9,7 @@ return function (uri, callback)
return
end
- guide.eachSourceType(state.ast, 'loop', function (source)
+ searcher.eachSourceType(state.ast, 'loop', function (source)
if not source.loc or not source.loc.value then
return
end
diff --git a/script/core/diagnostics/deprecated.lua b/script/core/diagnostics/deprecated.lua
index 60d60946..d6bccc10 100644
--- a/script/core/diagnostics/deprecated.lua
+++ b/script/core/diagnostics/deprecated.lua
@@ -1,10 +1,10 @@
-local files = require 'files'
-local vm = require 'vm'
-local lang = require 'language'
-local guide = require 'core.guide'
-local config = require 'config'
-local define = require 'proto.define'
-local await = require 'await'
+local files = require 'files'
+local vm = require 'vm'
+local lang = require 'language'
+local searcher = require 'core.searcher'
+local config = require 'config'
+local define = require 'proto.define'
+local await = require 'await'
return function (uri, callback)
local ast = files.getAst(uri)
@@ -12,7 +12,7 @@ return function (uri, callback)
return
end
- guide.eachSource(ast.ast, function (src)
+ searcher.eachSource(ast.ast, function (src)
if src.type ~= 'getglobal'
and src.type ~= 'getfield'
and src.type ~= 'getindex'
@@ -20,7 +20,7 @@ return function (uri, callback)
return
end
if src.type == 'getglobal' then
- local key = guide.getKeyName(src)
+ local key = searcher.getKeyName(src)
if not key then
return
end
diff --git a/script/core/diagnostics/duplicate-doc-class.lua b/script/core/diagnostics/duplicate-doc-class.lua
index 8c6696a9..c625d234 100644
--- a/script/core/diagnostics/duplicate-doc-class.lua
+++ b/script/core/diagnostics/duplicate-doc-class.lua
@@ -1,8 +1,7 @@
-local files = require 'files'
-local guide = require 'core.guide'
-local lang = require 'language'
-local define = require 'proto.define'
-local vm = require 'vm'
+local files = require 'files'
+local searcher = require 'core.searcher'
+local lang = require 'language'
+local vm = require 'vm'
return function (uri, callback)
local state = files.getAst(uri)
@@ -18,7 +17,7 @@ return function (uri, callback)
for _, doc in ipairs(state.ast.docs) do
if doc.type == 'doc.class'
or doc.type == 'doc.alias' then
- local name = guide.getKeyName(doc)
+ local name = searcher.getKeyName(doc)
if not cache[name] then
local docs = vm.getDocTypes(name)
cache[name] = {}
@@ -28,7 +27,7 @@ return function (uri, callback)
cache[name][#cache[name]+1] = {
start = otherDoc.start,
finish = otherDoc.finish,
- uri = guide.getUri(otherDoc),
+ uri = searcher.getUri(otherDoc),
}
end
end
diff --git a/script/core/diagnostics/duplicate-index.lua b/script/core/diagnostics/duplicate-index.lua
index 5e63d39e..65fb00cd 100644
--- a/script/core/diagnostics/duplicate-index.lua
+++ b/script/core/diagnostics/duplicate-index.lua
@@ -1,8 +1,8 @@
-local files = require 'files'
-local guide = require 'core.guide'
-local lang = require 'language'
-local define = require 'proto.define'
-local vm = require 'vm'
+local files = require 'files'
+local searcher = require 'core.searcher'
+local lang = require 'language'
+local define = require 'proto.define'
+local vm = require 'vm'
return function (uri, callback)
local ast = files.getAst(uri)
@@ -10,7 +10,7 @@ return function (uri, callback)
return
end
- guide.eachSourceType(ast.ast, 'table', function (source)
+ searcher.eachSourceType(ast.ast, 'table', function (source)
local mark = {}
for _, obj in ipairs(source) do
if obj.type == 'tablefield'
diff --git a/script/core/diagnostics/duplicate-set-field.lua b/script/core/diagnostics/duplicate-set-field.lua
index c1e2285a..ff915217 100644
--- a/script/core/diagnostics/duplicate-set-field.lua
+++ b/script/core/diagnostics/duplicate-set-field.lua
@@ -1,8 +1,7 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local lang = require 'language'
local define = require 'proto.define'
-local vm = require 'vm'
return function (uri, callback)
local ast = files.getAst(uri)
@@ -10,7 +9,7 @@ return function (uri, callback)
return
end
- guide.eachSourceType(ast.ast, 'local', function (source)
+ searcher.eachSourceType(ast.ast, 'local', function (source)
if not source.ref then
return
end
@@ -26,11 +25,11 @@ return function (uri, callback)
if nxt.type == 'setfield'
or nxt.type == 'setmethod'
or nxt.type == 'setindex' then
- local name = guide.getKeyName(nxt)
+ local name = searcher.getKeyName(nxt)
if not name then
goto CONTINUE
end
- local value = guide.getObjectValue(nxt)
+ local value = searcher.getObjectValue(nxt)
if not value or value.type ~= 'function' then
goto CONTINUE
end
@@ -47,7 +46,7 @@ return function (uri, callback)
end
local blocks = {}
for _, value in ipairs(values) do
- local block = guide.getBlock(value)
+ local block = searcher.getBlock(value)
if not blocks[block] then
blocks[block] = {}
end
diff --git a/script/core/diagnostics/empty-block.lua b/script/core/diagnostics/empty-block.lua
index 690a4ca2..abd20bde 100644
--- a/script/core/diagnostics/empty-block.lua
+++ b/script/core/diagnostics/empty-block.lua
@@ -1,5 +1,5 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local lang = require 'language'
local define = require 'proto.define'
@@ -11,7 +11,7 @@ return function (uri, callback)
return
end
- guide.eachSourceType(ast.ast, 'if', function (source)
+ searcher.eachSourceType(ast.ast, 'if', function (source)
for _, block in ipairs(source) do
if #block > 0 then
return
@@ -24,7 +24,7 @@ return function (uri, callback)
message = lang.script.DIAG_EMPTY_BLOCK,
}
end)
- guide.eachSourceType(ast.ast, 'loop', function (source)
+ searcher.eachSourceType(ast.ast, 'loop', function (source)
if #source > 0 then
return
end
@@ -35,7 +35,7 @@ return function (uri, callback)
message = lang.script.DIAG_EMPTY_BLOCK,
}
end)
- guide.eachSourceType(ast.ast, 'in', function (source)
+ searcher.eachSourceType(ast.ast, 'in', function (source)
if #source > 0 then
return
end
diff --git a/script/core/diagnostics/global-in-nil-env.lua b/script/core/diagnostics/global-in-nil-env.lua
index de23bc76..02cd4f3f 100644
--- a/script/core/diagnostics/global-in-nil-env.lua
+++ b/script/core/diagnostics/global-in-nil-env.lua
@@ -1,5 +1,5 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local lang = require 'language'
-- TODO: 检查路径是否可达
@@ -12,8 +12,8 @@ return function (uri, callback)
if not ast then
return
end
- local root = guide.getRoot(ast.ast)
- local env = guide.getENV(root)
+ local root = searcher.getRoot(ast.ast)
+ local env = searcher.getENV(root)
local nilDefs = {}
if not env.ref then
@@ -36,7 +36,7 @@ return function (uri, callback)
if node.tag == '_ENV' then
local ok
for _, nilDef in ipairs(nilDefs) do
- local mode, pathA = guide.getPath(nilDef, source)
+ local mode, pathA = searcher.getPath(nilDef, source)
if mode == 'before'
and mayRun(pathA) then
ok = nilDef
@@ -61,6 +61,6 @@ return function (uri, callback)
end
end
- guide.eachSourceType(ast.ast, 'getglobal', check)
- guide.eachSourceType(ast.ast, 'setglobal', check)
+ searcher.eachSourceType(ast.ast, 'getglobal', check)
+ searcher.eachSourceType(ast.ast, 'setglobal', check)
end
diff --git a/script/core/diagnostics/lowercase-global.lua b/script/core/diagnostics/lowercase-global.lua
index 9c094701..aaeb2c94 100644
--- a/script/core/diagnostics/lowercase-global.lua
+++ b/script/core/diagnostics/lowercase-global.lua
@@ -1,5 +1,5 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local lang = require 'language'
local config = require 'config'
local vm = require 'vm'
@@ -28,8 +28,8 @@ return function (uri, callback)
definedGlobal[name] = true
end
- guide.eachSourceType(ast.ast, 'setglobal', function (source)
- local name = guide.getKeyName(source)
+ searcher.eachSourceType(ast.ast, 'setglobal', function (source)
+ local name = searcher.getKeyName(source)
if definedGlobal[name] then
return
end
diff --git a/script/core/diagnostics/newfield-call.lua b/script/core/diagnostics/newfield-call.lua
index 0727c2fd..a71ae3e1 100644
--- a/script/core/diagnostics/newfield-call.lua
+++ b/script/core/diagnostics/newfield-call.lua
@@ -1,5 +1,5 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local lang = require 'language'
return function (uri, callback)
@@ -11,15 +11,15 @@ return function (uri, callback)
local lines = files.getLines(uri)
local text = files.getText(uri)
- guide.eachSourceType(ast.ast, 'table', function (source)
+ searcher.eachSourceType(ast.ast, 'table', function (source)
for i = 1, #source do
local field = source[i]
if field.type == 'call' then
local func = field.node
local args = field.args
if args then
- local funcLine = guide.positionOf(lines, func.finish)
- local argsLine = guide.positionOf(lines, args.start)
+ local funcLine = searcher.positionOf(lines, func.finish)
+ local argsLine = searcher.positionOf(lines, args.start)
if argsLine > funcLine then
callback {
start = field.start,
diff --git a/script/core/diagnostics/newline-call.lua b/script/core/diagnostics/newline-call.lua
index 807f76a2..31a8d09f 100644
--- a/script/core/diagnostics/newline-call.lua
+++ b/script/core/diagnostics/newline-call.lua
@@ -1,5 +1,5 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local lang = require 'language'
return function (uri, callback)
@@ -10,7 +10,7 @@ return function (uri, callback)
return
end
- guide.eachSourceType(ast.ast, 'call', function (source)
+ searcher.eachSourceType(ast.ast, 'call', function (source)
local node = source.node
local args = source.args
if not args then
@@ -26,8 +26,8 @@ return function (uri, callback)
return
end
- local nodeRow = guide.positionOf(lines, node.finish)
- local argRow = guide.positionOf(lines, args.start)
+ local nodeRow = searcher.positionOf(lines, node.finish)
+ local argRow = searcher.positionOf(lines, args.start)
if nodeRow == argRow then
return
end
diff --git a/script/core/diagnostics/no-implicit-any.lua b/script/core/diagnostics/no-implicit-any.lua
index ffaab821..23af570a 100644
--- a/script/core/diagnostics/no-implicit-any.lua
+++ b/script/core/diagnostics/no-implicit-any.lua
@@ -1,5 +1,5 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local lang = require 'language'
local define = require 'proto.define'
local vm = require 'vm'
@@ -10,7 +10,7 @@ return function (uri, callback)
return
end
- guide.eachSource(ast.ast, function (source)
+ searcher.eachSource(ast.ast, function (source)
if source.type ~= 'local'
and source.type ~= 'setlocal'
and source.type ~= 'setglobal'
diff --git a/script/core/diagnostics/redefined-local.lua b/script/core/diagnostics/redefined-local.lua
index 857d80d2..4922831b 100644
--- a/script/core/diagnostics/redefined-local.lua
+++ b/script/core/diagnostics/redefined-local.lua
@@ -1,5 +1,5 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local lang = require 'language'
return function (uri, callback)
@@ -7,13 +7,13 @@ return function (uri, callback)
if not ast then
return
end
- guide.eachSourceType(ast.ast, 'local', function (source)
+ searcher.eachSourceType(ast.ast, 'local', function (source)
local name = source[1]
if name == '_'
or name == ast.ENVMode then
return
end
- local exist = guide.getLocal(source, name, source.start-1)
+ local exist = searcher.getLocal(source, name, source.start-1)
if exist then
callback {
start = source.start,
diff --git a/script/core/diagnostics/redundant-parameter.lua b/script/core/diagnostics/redundant-parameter.lua
index c5bcd5a5..a6907bda 100644
--- a/script/core/diagnostics/redundant-parameter.lua
+++ b/script/core/diagnostics/redundant-parameter.lua
@@ -1,5 +1,5 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local vm = require 'vm'
local lang = require 'language'
local define = require 'proto.define'
@@ -74,7 +74,7 @@ return function (uri, callback)
local cache = vm.getCache 'redundant-parameter'
- guide.eachSourceType(ast.ast, 'call', function (source)
+ searcher.eachSourceType(ast.ast, 'call', function (source)
local callArgs = countCallArgs(source)
if callArgs == 0 then
return
diff --git a/script/core/diagnostics/trailing-space.lua b/script/core/diagnostics/trailing-space.lua
index 0a4b1d57..6ee92d26 100644
--- a/script/core/diagnostics/trailing-space.lua
+++ b/script/core/diagnostics/trailing-space.lua
@@ -1,10 +1,10 @@
local files = require 'files'
local lang = require 'language'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local function isInString(ast, offset)
local result = false
- guide.eachSourceType(ast, 'string', function (source)
+ searcher.eachSourceType(ast, 'string', function (source)
if offset >= source.start and offset <= source.finish then
result = true
end
diff --git a/script/core/diagnostics/unbalanced-assignments.lua b/script/core/diagnostics/unbalanced-assignments.lua
index b2b2800c..006223db 100644
--- a/script/core/diagnostics/unbalanced-assignments.lua
+++ b/script/core/diagnostics/unbalanced-assignments.lua
@@ -1,7 +1,7 @@
local files = require 'files'
local define = require 'proto.define'
local lang = require 'language'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
return function (uri, callback, code)
local ast = files.getAst(uri)
@@ -31,7 +31,7 @@ return function (uri, callback, code)
end
end
- guide.eachSource(ast.ast, function (source)
+ searcher.eachSource(ast.ast, function (source)
if source.type == 'local'
or source.type == 'setlocal'
or source.type == 'setglobal'
diff --git a/script/core/diagnostics/undefined-doc-class.lua b/script/core/diagnostics/undefined-doc-class.lua
index a91cfa7f..991b5849 100644
--- a/script/core/diagnostics/undefined-doc-class.lua
+++ b/script/core/diagnostics/undefined-doc-class.lua
@@ -1,5 +1,5 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local lang = require 'language'
local define = require 'proto.define'
local vm = require 'vm'
diff --git a/script/core/diagnostics/undefined-doc-name.lua b/script/core/diagnostics/undefined-doc-name.lua
index d8a4363b..54f08ee6 100644
--- a/script/core/diagnostics/undefined-doc-name.lua
+++ b/script/core/diagnostics/undefined-doc-name.lua
@@ -1,5 +1,5 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local lang = require 'language'
local define = require 'proto.define'
local vm = require 'vm'
@@ -44,7 +44,7 @@ return function (uri, callback)
return true
end
- guide.eachSource(state.ast.docs, function (source)
+ searcher.eachSource(state.ast.docs, function (source)
if source.type ~= 'doc.extends.name'
and source.type ~= 'doc.type.name' then
return
diff --git a/script/core/diagnostics/undefined-doc-param.lua b/script/core/diagnostics/undefined-doc-param.lua
index 0bf371e5..4a97947d 100644
--- a/script/core/diagnostics/undefined-doc-param.lua
+++ b/script/core/diagnostics/undefined-doc-param.lua
@@ -1,5 +1,5 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local lang = require 'language'
local define = require 'proto.define'
local vm = require 'vm'
diff --git a/script/core/diagnostics/undefined-env-child.lua b/script/core/diagnostics/undefined-env-child.lua
index 89efb8c7..a32ad306 100644
--- a/script/core/diagnostics/undefined-env-child.lua
+++ b/script/core/diagnostics/undefined-env-child.lua
@@ -1,5 +1,5 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local vm = require 'vm'
local lang = require 'language'
@@ -8,12 +8,12 @@ return function (uri, callback)
if not ast then
return
end
- guide.eachSourceType(ast.ast, 'getglobal', function (source)
+ searcher.eachSourceType(ast.ast, 'getglobal', function (source)
-- 单独验证自己是否在重载过的 _ENV 中有定义
if source.node.tag == '_ENV' then
return
end
- local defs = guide.requestDefinition(source)
+ local defs = searcher.requestDefinition(source)
if #defs > 0 then
return
end
diff --git a/script/core/diagnostics/undefined-field.lua b/script/core/diagnostics/undefined-field.lua
index b10c9ab0..1f88740e 100644
--- a/script/core/diagnostics/undefined-field.lua
+++ b/script/core/diagnostics/undefined-field.lua
@@ -2,7 +2,7 @@ local files = require 'files'
local vm = require 'vm'
local lang = require 'language'
local config = require 'config'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local define = require 'proto.define'
return function (uri, callback)
@@ -87,7 +87,7 @@ return function (uri, callback)
end
local function checkUndefinedField(src)
- local fieldName = guide.getKeyName(src)
+ local fieldName = searcher.getKeyName(src)
local allDocClass = getAllDocClassFromInfer(src.node)
if (not allDocClass) or (#allDocClass == 0) then
@@ -118,6 +118,6 @@ return function (uri, callback)
end
end
end
- guide.eachSourceType(ast.ast, 'getfield', checkUndefinedField);
- guide.eachSourceType(ast.ast, 'getmethod', checkUndefinedField);
+ searcher.eachSourceType(ast.ast, 'getfield', checkUndefinedField);
+ searcher.eachSourceType(ast.ast, 'getmethod', checkUndefinedField);
end
diff --git a/script/core/diagnostics/undefined-global.lua b/script/core/diagnostics/undefined-global.lua
index 161d8856..3c7f02d1 100644
--- a/script/core/diagnostics/undefined-global.lua
+++ b/script/core/diagnostics/undefined-global.lua
@@ -2,7 +2,7 @@ local files = require 'files'
local vm = require 'vm'
local lang = require 'language'
local config = require 'config'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local define = require 'proto.define'
local requireLike = {
@@ -19,8 +19,8 @@ return function (uri, callback)
end
-- 遍历全局变量,检查所有没有 set 模式的全局变量
- guide.eachSourceType(ast.ast, 'getglobal', function (src)
- local key = guide.getKeyName(src)
+ searcher.eachSourceType(ast.ast, 'getglobal', function (src)
+ local key = searcher.getKeyName(src)
if not key then
return
end
diff --git a/script/core/diagnostics/unused-function.lua b/script/core/diagnostics/unused-function.lua
index b6f92e60..2d224e5e 100644
--- a/script/core/diagnostics/unused-function.lua
+++ b/script/core/diagnostics/unused-function.lua
@@ -1,5 +1,5 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local vm = require 'vm'
local define = require 'proto.define'
local lang = require 'language'
@@ -45,7 +45,7 @@ return function (uri, callback)
local refs = vm.getRefs(source)
for _, src in ipairs(refs) do
if vm.isGet(src) then
- local func = guide.getParentFunction(src)
+ local func = searcher.getParentFunction(src)
if not checkFunction(func) then
hasGet = true
break
@@ -75,7 +75,7 @@ return function (uri, callback)
end
-- 只检查局部函数
- guide.eachSourceType(ast.ast, 'function', function (source)
+ searcher.eachSourceType(ast.ast, 'function', function (source)
checkFunction(source)
end)
end
diff --git a/script/core/diagnostics/unused-label.lua b/script/core/diagnostics/unused-label.lua
index e2d5e49a..5d9488a1 100644
--- a/script/core/diagnostics/unused-label.lua
+++ b/script/core/diagnostics/unused-label.lua
@@ -1,5 +1,5 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local define = require 'proto.define'
local lang = require 'language'
@@ -9,7 +9,7 @@ return function (uri, callback)
return
end
- guide.eachSourceType(ast.ast, 'label', function (source)
+ searcher.eachSourceType(ast.ast, 'label', function (source)
if not source.ref then
callback {
start = source.start,
diff --git a/script/core/diagnostics/unused-local.lua b/script/core/diagnostics/unused-local.lua
index fde90cb8..4e3c8217 100644
--- a/script/core/diagnostics/unused-local.lua
+++ b/script/core/diagnostics/unused-local.lua
@@ -1,5 +1,5 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local define = require 'proto.define'
local lang = require 'language'
@@ -81,7 +81,7 @@ return function (uri, callback)
if not ast then
return
end
- guide.eachSourceType(ast.ast, 'local', function (source)
+ searcher.eachSourceType(ast.ast, 'local', function (source)
local name = source[1]
if name == '_'
or name == ast.ENVMode then
diff --git a/script/core/diagnostics/unused-vararg.lua b/script/core/diagnostics/unused-vararg.lua
index ec0a05fb..301394c3 100644
--- a/script/core/diagnostics/unused-vararg.lua
+++ b/script/core/diagnostics/unused-vararg.lua
@@ -1,5 +1,5 @@
local files = require 'files'
-local guide = require 'core.guide'
+local searcher = require 'core.searcher'
local define = require 'proto.define'
local lang = require 'language'
@@ -9,7 +9,7 @@ return function (uri, callback)
return
end
- guide.eachSourceType(ast.ast, 'function', function (source)
+ searcher.eachSourceType(ast.ast, 'function', function (source)
local args = source.args
if not args then
return