summaryrefslogtreecommitdiff
path: root/script-beta
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-08-17 15:13:56 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-08-17 15:13:56 +0800
commitdea8e5a934ffe566ec26ee2e0fabc1e5406a4b22 (patch)
tree5a55eb3dfd92adce81ba57f23d90a7f58e580b90 /script-beta
parent210a400e2c6f222ce0ad6c038a2e03cea117c877 (diff)
downloadlua-language-server-dea8e5a934ffe566ec26ee2e0fabc1e5406a4b22.zip
更新
Diffstat (limited to 'script-beta')
-rw-r--r--script-beta/core/highlight.lua19
-rw-r--r--script-beta/parser/guide.lua4
2 files changed, 19 insertions, 4 deletions
diff --git a/script-beta/core/highlight.lua b/script-beta/core/highlight.lua
index e2ed2c43..3a2fd31c 100644
--- a/script-beta/core/highlight.lua
+++ b/script-beta/core/highlight.lua
@@ -11,11 +11,22 @@ local function eachRef(source, callback)
end
end
+local function eachLocal(source, callback)
+ callback(source)
+ if source.ref then
+ for _, ref in ipairs(source.ref) do
+ callback(ref)
+ end
+ end
+end
+
local function find(source, uri, callback)
- if source.type == 'local'
- or source.type == 'getlocal'
- or source.type == 'setlocal'
- or source.type == 'field'
+ if source.type == 'local' then
+ eachLocal(source, callback)
+ elseif source.type == 'getlocal'
+ or source.type == 'setlocal' then
+ eachLocal(source.node, callback)
+ elseif source.type == 'field'
or source.type == 'method'
or source.type == 'getindex'
or source.type == 'setindex'
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua
index a6d5be3b..f74dc56c 100644
--- a/script-beta/parser/guide.lua
+++ b/script-beta/parser/guide.lua
@@ -2541,6 +2541,10 @@ function m.inferByDef(status, obj)
end
local function inferBySetOfLocal(status, source)
+ if status.cache[source] then
+ return
+ end
+ status.cache[source] = true
if source.ref then
local newStatus = m.status(status)
for _, ref in ipairs(source.ref) do