summaryrefslogtreecommitdiff
path: root/script-beta/parser/guide.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-10 10:38:34 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-10 10:38:34 +0800
commit63896ba92a934bdb6a4952882f486d1389a92a67 (patch)
tree687c6c807dacbfae54ea9a21a0cf984227cc8a7f /script-beta/parser/guide.lua
parent86f40ba0cbdb6ef0762e7b7bd681568f83d312e7 (diff)
downloadlua-language-server-63896ba92a934bdb6a4952882f486d1389a92a67.zip
#244 向前搜索赋值不受搜索深度影响,经测试该功能对性能影响很小
Diffstat (limited to 'script-beta/parser/guide.lua')
-rw-r--r--script-beta/parser/guide.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua
index 88a09481..cbb64cf4 100644
--- a/script-beta/parser/guide.lua
+++ b/script-beta/parser/guide.lua
@@ -1780,6 +1780,9 @@ function m.searchSameFieldsInValue(status, ref, start, queue, mode)
end
function m.checkSameSimpleAsTableField(status, ref, start, queue)
+ if not status.deep then
+ return
+ end
local parent = ref.parent
if not parent or parent.type ~= 'tablefield' then
return
@@ -1809,6 +1812,9 @@ function m.checkSearchLevel(status)
end
function m.checkSameSimpleAsReturn(status, ref, start, queue)
+ if not status.deep then
+ return
+ end
if not ref.parent or ref.parent.type ~= 'return' then
return
end
@@ -2007,7 +2013,7 @@ function m.checkSameSimple(status, simple, data, mode, queue)
m.checkSameSimpleInValueOfCallMetaTable(status, ref, i, queue)
-- 检查自己是特殊变量的分支的情况
m.checkSameSimpleInSpecialBranch(status, ref, i, queue)
- if cmode == 'ref' and status.deep then
+ if cmode == 'ref' then
-- 检查形如 { a = f } 的情况
m.checkSameSimpleAsTableField(status, ref, i, queue)
-- 检查形如 return m 的情况