summaryrefslogtreecommitdiff
path: root/script-beta/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-10-21 15:30:30 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-10-21 15:30:30 +0800
commit3b1bdeeb79d1f7d49df1002c436511fdf20a57ff (patch)
treebb990a581bfb5473467eef69a95d3aff536aaac9 /script-beta/parser
parent7e1f7304019bb9c8a9e1d7cefdddbcf43e3871f5 (diff)
downloadlua-language-server-3b1bdeeb79d1f7d49df1002c436511fdf20a57ff.zip
优化
Diffstat (limited to 'script-beta/parser')
-rw-r--r--script-beta/parser/guide.lua18
1 files changed, 13 insertions, 5 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua
index e4b58c56..7bcf3165 100644
--- a/script-beta/parser/guide.lua
+++ b/script-beta/parser/guide.lua
@@ -979,7 +979,8 @@ function m.getStepRef(status, obj, mode)
end
if obj.type == 'doc.class.name'
or obj.type == 'doc.type.name'
- or obj.type == 'doc.extends.name' then
+ or obj.type == 'doc.extends.name'
+ or obj.type == 'doc.alias.name' then
return stepRefOfDocType(status, obj, mode)
end
return nil
@@ -1556,6 +1557,9 @@ function m.checkSameSimpleInCallInSameFile(status, func, args, index)
end
function m.checkSameSimpleInCall(status, ref, start, queue, mode)
+ if status.simple then
+ return
+ end
local func, args, index = m.getCallValue(ref)
if not func then
return
@@ -1563,6 +1567,11 @@ function m.checkSameSimpleInCall(status, ref, start, queue, mode)
if m.checkCallMark(status, func.parent, true) then
return
end
+ status.cache.crossCallCount = status.cache.crossCallCount or 0
+ if status.cache.crossCallCount >= 5 then
+ return
+ end
+ status.cache.crossCallCount = status.cache.crossCallCount + 1
-- 检查赋值是 semetatable() 的情况
m.checkSameSimpleInValueOfSetMetaTable(status, func, start, queue)
-- 检查赋值是 func() 的情况
@@ -1586,6 +1595,7 @@ function m.checkSameSimpleInCall(status, ref, start, queue, mode)
force = true,
}
end
+ status.cache.crossCallCount = status.cache.crossCallCount - 1
for _, obj in ipairs(newStatus.results) do
queue[#queue+1] = {
obj = obj,
@@ -1681,10 +1691,8 @@ function m.searchSameFieldsInValue(status, ref, start, queue, mode)
force = true,
}
-- 检查形如 a = f() 的分支情况
- if mode ~= 'field'
- and not status.simple then
- m.checkSameSimpleInCall(status, value, start, queue, mode)
- end
+ m.checkSameSimpleInCall(status, value, start, queue, mode)
+
-- 检查自己是字面量表的情况
--m.checkSameSimpleInValueOfTable(status, value, start, queue)
end