summaryrefslogtreecommitdiff
path: root/script/vm/ref.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-03-25 23:28:55 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-03-25 23:28:55 +0800
commit40cce47bf1f7bfd4d8945a0a189367f9dbb12f2d (patch)
tree4cd55f60d6d5925603e171b9d7b4635afe963a80 /script/vm/ref.lua
parent438df4d04ad4bd978226868e85723b28a7765be4 (diff)
downloadlua-language-server-40cce47bf1f7bfd4d8945a0a189367f9dbb12f2d.zip
update
Diffstat (limited to 'script/vm/ref.lua')
-rw-r--r--script/vm/ref.lua34
1 files changed, 17 insertions, 17 deletions
diff --git a/script/vm/ref.lua b/script/vm/ref.lua
index 2574a098..be709950 100644
--- a/script/vm/ref.lua
+++ b/script/vm/ref.lua
@@ -68,9 +68,19 @@ simpleMap = util.switch()
: case 'goto'
: call(function (source, pushResult)
if source.node then
+ simpleMap['label'](source.node, pushResult)
pushResult(source.node)
end
end)
+ : case 'label'
+ : call(function (source, pushResult)
+ pushResult(source)
+ if source.ref then
+ for _, ref in ipairs(source.ref) do
+ pushResult(ref)
+ end
+ end
+ end)
: getMap()
local searchFieldMap = util.switch()
@@ -106,9 +116,7 @@ local searchFieldMap = util.switch()
local sources = localID.getSources(node, key)
if sources then
for _, src in ipairs(sources) do
- if guide.isSet(src) then
- pushResult(src)
- end
+ pushResult(src)
end
end
end)
@@ -181,9 +189,7 @@ local function searchByLocalID(source, pushResult)
return
end
for _, src in ipairs(idSources) do
- if guide.isSet(src) then
- pushResult(src)
- end
+ pushResult(src)
end
end
@@ -202,10 +208,13 @@ local function searchByNode(source, pushResult)
return
end
for n in nodeMgr.eachNode(node) do
- if n.type == 'global' and n.cate == 'type' then
+ if n.type == 'global' then
for _, set in ipairs(n:getSets()) do
pushResult(set)
end
+ for _, get in ipairs(n:getGets()) do
+ pushResult(get)
+ end
else
pushResult(n)
end
@@ -226,16 +235,7 @@ function vm.getRefs(source)
end
if not mark[src] then
mark[src] = true
- if src.type == 'global' then
- for _, set in ipairs(src:getSets()) do
- pushResult(set)
- end
- return
- end
- if guide.isSet(src)
- or guide.isLiteral(src) then
- results[#results+1] = src
- end
+ results[#results+1] = src
end
end