From 40cce47bf1f7bfd4d8945a0a189367f9dbb12f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 25 Mar 2022 23:28:55 +0800 Subject: update --- script/vm/ref.lua | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'script/vm/ref.lua') 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 -- cgit v1.2.3