From c692372d9d37be181fddb891b2a9c91cd0ac1e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 22 Apr 2021 17:18:30 +0800 Subject: stash --- script/core/linker.lua | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'script/core/linker.lua') diff --git a/script/core/linker.lua b/script/core/linker.lua index e31d4eb9..31c65c93 100644 --- a/script/core/linker.lua +++ b/script/core/linker.lua @@ -211,6 +211,14 @@ local function checkForward(source) end end end + -- self -> mt:xx + if source.tag == 'self' then + local func = guide.getParentFunction(source) + local setmethod = func.parent + if setmethod and setmethod.type == 'setmethod' then + list[#list+1] = getID(setmethod.node) + end + end -- source 绑定的 @class/@type local bindDocs = source.bindDocs if bindDocs then @@ -232,6 +240,20 @@ local function checkForward(source) list[#list+1] = getID(source.class) list[#list+1] = getID(source.extends) end + -- 将call的返回值接收映射到函数返回值上 + if source.type == 'select' then + local call = source.vararg + if call.type == 'call' then + local node = call.node + local callID = ('%s%s%s%s'):format( + getID(node), + SPLIT_CHAR, + RETURN_INDEX_CHAR, + source.index + ) + list[#list+1] = callID + end + end if #list == 0 then return nil else @@ -252,14 +274,6 @@ local function checkBackward(source) if parent.value == source then list[#list+1] = getID(parent) end - -- self -> mt:xx - if source.tag == 'self' then - local func = guide.getParentFunction(source) - local setmethod = func.parent - if setmethod and setmethod.type == 'setmethod' then - list[#list+1] = getID(setmethod.node) - end - end -- name 映射回 class 与 type if source.type == 'doc.class.name' or source.type == 'doc.type.name' then -- cgit v1.2.3