summaryrefslogtreecommitdiff
path: root/script-beta/parser/guide.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-10-21 12:09:59 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-10-21 12:09:59 +0800
commit2a89c31ba0a7a4b7b3547d26bb977d74632b222c (patch)
tree713501cd83dfbf3105972675ced61acabeec3511 /script-beta/parser/guide.lua
parent27a6a7041f01d5f53693901ed9efd898bac31dbf (diff)
downloadlua-language-server-2a89c31ba0a7a4b7b3547d26bb977d74632b222c.zip
准备检查一下性能问题
Diffstat (limited to 'script-beta/parser/guide.lua')
-rw-r--r--script-beta/parser/guide.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua
index ff20ed36..82617af5 100644
--- a/script-beta/parser/guide.lua
+++ b/script-beta/parser/guide.lua
@@ -18,6 +18,8 @@ local assert = assert
local select = select
local osClock = os.clock
local DEVELOP = _G.DEVELOP
+local log = log
+local debug = debug
_ENV = nil
@@ -1394,6 +1396,9 @@ function m.checkSameSimpleByBindDocs(status, obj, start, queue, mode)
if not obj.bindDocs then
return
end
+ if status.cache.searchingBindedDoc then
+ return
+ end
local results = {}
for _, doc in ipairs(obj.bindDocs) do
if doc.type == 'doc.class' then
@@ -1409,6 +1414,7 @@ function m.checkSameSimpleByBindDocs(status, obj, start, queue, mode)
end
local mark = {}
local newStatus = m.status(status)
+ newStatus.cache.searchingBindedDoc = true
for _, res in ipairs(results) do
local source = m.getDocState(res)
local ref = source.bind
@@ -2181,8 +2187,12 @@ function m.searchRefs(status, obj, mode)
if simple then
m.searchSameFields(status, simple, mode)
end
- elseif m.debugMode then
- error('stack overflow')
+ else
+ if m.debugMode then
+ error('status.depth overflow')
+ elseif DEVELOP then
+ log.warn(debug.traceback('status.depth overflow'))
+ end
end
status.depth = status.depth - 1