summaryrefslogtreecommitdiff
path: root/script-beta/parser/guide.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-10-29 18:50:04 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-10-29 18:50:04 +0800
commit7981076619717ec1cd5c811762f4c60a445f3c8d (patch)
treede3a63d8f39423aa1a926b9c4d445f5d5718a8ab /script-beta/parser/guide.lua
parent8482ecd47e0b086424ec4e79db31b0b4f6c598f0 (diff)
downloadlua-language-server-7981076619717ec1cd5c811762f4c60a445f3c8d.zip
整理代码
Diffstat (limited to 'script-beta/parser/guide.lua')
-rw-r--r--script-beta/parser/guide.lua21
1 files changed, 7 insertions, 14 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua
index 1ae9e00a..be08b949 100644
--- a/script-beta/parser/guide.lua
+++ b/script-beta/parser/guide.lua
@@ -1180,15 +1180,14 @@ function m.status(parentStatus, interface)
cache = parentStatus and parentStatus.cache or {
count = 0,
},
- depth = parentStatus and parentStatus.depth or 0,
+ depth = parentStatus and (parentStatus.depth + 1) or 1,
interface = parentStatus and parentStatus.interface or {},
locks = parentStatus and parentStatus.locks or {},
- index = parentStatus and (parentStatus.index + 1) or 1,
- simple = parentStatus and parentStatus.simple,
+ simple = parentStatus and (parentStatus.simple or parentStatus.depth > 1),
results = {},
}
- status.lock = status.locks[status.index] or {}
- status.locks[status.index] = status.lock
+ status.lock = status.locks[status.depth] or {}
+ status.locks[status.depth] = status.lock
if interface then
for k, v in pairs(interface) do
status.interface[k] = v
@@ -2218,7 +2217,7 @@ end
function m.getRefCache(status, obj, mode)
local cache, globalCache
- if status.index == 1 then
+ if status.depth == 1 then
globalCache = status.interface.cache and status.interface.cache() or {}
end
cache = status.cache.refCache or {}
@@ -2257,7 +2256,6 @@ function m.searchRefs(status, obj, mode)
return
end
- status.depth = status.depth + 1
-- 检查单步引用
local res = m.getStepRef(status, obj, mode)
if res then
@@ -2280,8 +2278,6 @@ function m.searchRefs(status, obj, mode)
end
end
- status.depth = status.depth - 1
-
m.cleanResults(status.results)
if makeCache then
@@ -3090,14 +3086,11 @@ function m.inferCheckBinary(status, source)
end
function m.inferByDef(status, obj)
- if status.index > 3 then
- --return
- end
local mark = {}
- local newStatus = m.status(nil, status.interface)
+ local newStatus = m.status(status, status.interface)
m.searchRefs(newStatus, obj, 'def')
for _, src in ipairs(newStatus.results) do
- local inferStatus = m.status(status)
+ local inferStatus = m.status(newStatus)
m.searchInfer(inferStatus, src)
for _, infer in ipairs(inferStatus.results) do
if not mark[infer.source] then