summaryrefslogtreecommitdiff
path: root/script-beta/vm/eachRef.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-12-20 18:08:11 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-12-20 18:08:11 +0800
commitb02922cb72d175501bf41fe5c7d3e7c71d71b0b6 (patch)
treefee38471f244fb7be7f3766a9ab35fe62e43139b /script-beta/vm/eachRef.lua
parent2213f1332859562505a39a85cebb14d11265f95f (diff)
downloadlua-language-server-b02922cb72d175501bf41fe5c7d3e7c71d71b0b6.zip
暂存
Diffstat (limited to 'script-beta/vm/eachRef.lua')
-rw-r--r--script-beta/vm/eachRef.lua30
1 files changed, 4 insertions, 26 deletions
diff --git a/script-beta/vm/eachRef.lua b/script-beta/vm/eachRef.lua
index 976901c1..45f35b20 100644
--- a/script-beta/vm/eachRef.lua
+++ b/script-beta/vm/eachRef.lua
@@ -10,8 +10,10 @@ local function ofLocal(loc, callback)
mode = 'declare',
}
end
- if loc.ref then
- for _, ref in ipairs(loc.ref) do
+ local refs = loc.ref
+ if refs then
+ for i = 1, #refs do
+ local ref = refs[i]
if ref.type == 'getlocal' then
callback {
source = ref,
@@ -25,29 +27,6 @@ local function ofLocal(loc, callback)
end
end
end
- if loc.tag == '_ENV' and loc.ref then
- for _, ref in ipairs(loc.ref) do
- if ref.type == 'getlocal' then
- local parent = ref.parent
- if parent.type == 'getfield'
- or parent.type == 'getindex' then
- if guide.getKeyName(parent) == '_G' then
- callback {
- source = parent,
- mode = 'get',
- }
- end
- end
- elseif ref.type == 'getglobal' then
- if guide.getName(ref) == '_G' then
- callback {
- source = ref,
- mode = 'get',
- }
- end
- end
- end
- end
end
local function ofGlobal(source, callback)
@@ -172,7 +151,6 @@ end
--- 获取所有的引用
function vm.eachRef(source, callback, max)
local mark = {}
- local result = {}
eachRef(source, function (info)
local src = info.source
if mark[src] then