summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-15 01:29:21 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-15 01:29:21 +0800
commit738f3410ed8dd2b6c5203fd984d5966d510a1d79 (patch)
treeeced293a1e56f3729388338d57dff6b6ccac0a37 /script
parent767db22f89459bad7e466d0e467f72f43f0c2046 (diff)
downloadlua-language-server-738f3410ed8dd2b6c5203fd984d5966d510a1d79.zip
#1208 avoid dead cycles
Diffstat (limited to 'script')
-rw-r--r--script/vm/infer.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/script/vm/infer.lua b/script/vm/infer.lua
index 9bcd3963..422990f8 100644
--- a/script/vm/infer.lua
+++ b/script/vm/infer.lua
@@ -20,6 +20,8 @@ mt._isLocal = false
vm.NULL = setmetatable({}, mt)
+local LOCK = {}
+
local inferSorted = {
['boolean'] = - 100,
['string'] = - 99,
@@ -218,6 +220,10 @@ function mt:_eraseAlias(uri)
local expandAlias = config.get(uri, 'Lua.hover.expandAlias')
for n in self.node:eachObject() do
if n.type == 'global' and n.cate == 'type' then
+ if LOCK[n.name] then
+ goto CONTINUE
+ end
+ LOCK[n.name] = true
for _, set in ipairs(n:getSets(uri)) do
if set.type == 'doc.alias' then
if expandAlias then
@@ -239,6 +245,8 @@ function mt:_eraseAlias(uri)
end
end
end
+ LOCK[n.name] = nil
+ ::CONTINUE::
end
end
return drop