From c586a11e9ae9b3f001c39d7f2f6762b0cf7af671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 25 May 2022 15:45:35 +0800 Subject: fix #1155 --- script/vm/ref.lua | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'script/vm/ref.lua') diff --git a/script/vm/ref.lua b/script/vm/ref.lua index 545c294a..fbb9d015 100644 --- a/script/vm/ref.lua +++ b/script/vm/ref.lua @@ -279,10 +279,22 @@ local function searchByDef(source, pushResult) defMap[source] = true return defMap end - local defs = vm.getDefs(source) - for _, def in ipairs(defs) do - pushResult(def) - defMap[def] = true + if source.type == 'field' + or source.type == 'method' then + source = source.parent + end + defMap[source] = true + if guide.isSet(source) then + local defs = vm.getDefs(source) + for _, def in ipairs(defs) do + pushResult(def) + end + else + local defs = vm.getDefs(source) + for _, def in ipairs(defs) do + pushResult(def) + defMap[def] = true + end end return defMap end -- cgit v1.2.3