From 9451329b33de1e7b69f2793ac5f94715826c9895 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, 4 Mar 2022 16:06:28 +0800 Subject: update --- script/vm/getDef.lua | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'script/vm/getDef.lua') diff --git a/script/vm/getDef.lua b/script/vm/getDef.lua index b6897bea..8b3e610d 100644 --- a/script/vm/getDef.lua +++ b/script/vm/getDef.lua @@ -85,13 +85,23 @@ local searchFieldMap = util.switch() end end) : case 'global' + ---@param node vm.node + ---@param key string : call(function (node, key, pushResult) - local newGlobal = globalMgr.getGlobal('variable', node.name, key) - if not newGlobal then - return + if node.cate == 'variable' then + local newGlobal = globalMgr.getGlobal('variable', node.name, key) + if newGlobal then + for _, set in ipairs(newGlobal:getSets()) do + pushResult(set) + end + end end - for _, set in ipairs(newGlobal:getSets()) do - pushResult(set) + if node.cate == 'type' then + compiler.getClassFields(node, key, function (field) + if field.type == 'doc.field' then + pushResult(field.field) + end + end) end end) : case 'local' -- cgit v1.2.3