summaryrefslogtreecommitdiff
path: root/script-beta/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-08-14 18:15:27 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-08-14 18:15:27 +0800
commitde6582c44f4ca5e3bd10e2a3a5f875ee61f64569 (patch)
treea54a1a06ea9dbeeab7e1833301aa9980e4b9fdf7 /script-beta/parser
parent7f735dff2b5fcadb39973e3d2144fd1a3630a090 (diff)
downloadlua-language-server-de6582c44f4ca5e3bd10e2a3a5f875ee61f64569.zip
简单计算一下复杂度
Diffstat (limited to 'script-beta/parser')
-rw-r--r--script-beta/parser/guide.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua
index 8d7c3d9c..d295bf8b 100644
--- a/script-beta/parser/guide.lua
+++ b/script-beta/parser/guide.lua
@@ -904,7 +904,9 @@ m.Version = 53
function m.status(parentStatus, interface)
local status = {
- cache = parentStatus and parentStatus.cache or {},
+ cache = parentStatus and parentStatus.cache or {
+ count = 0,
+ },
depth = parentStatus and parentStatus.depth or 0,
interface = parentStatus and parentStatus.interface or {},
lock = parentStatus and parentStatus.lock or {},
@@ -1583,6 +1585,7 @@ function m.searchSameFields(status, simple, mode)
if not mark[data.obj] then
status.lock[data.obj] = true
mark[data.obj] = true
+ status.cache.count = status.cache.count + 1
m.checkSameSimple(status, simple, data, mode, status.results, queue)
status.lock[data.obj] = nil
end
@@ -1752,7 +1755,11 @@ function m.requestReference(obj, interface)
m.searchRefsAsFunction(status, obj, 'ref')
- return status.results
+ if m.debugMode then
+ print('count:', status.cache.count)
+ end
+
+ return status.results, status.cache.count
end
--- 请求对象的定义,包括 `a.b.c` 形式
@@ -1763,7 +1770,7 @@ function m.requestDefinition(obj, interface)
-- 根据 field 搜索定义
m.searchRefs(status, obj, 'def')
- return status.results
+ return status.results, status.cache.count
end
--- 请求对象的域