summaryrefslogtreecommitdiff
path: root/script/core/linker.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-04-22 17:18:30 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-04-22 17:18:30 +0800
commitc692372d9d37be181fddb891b2a9c91cd0ac1e0d (patch)
tree0f0c7c37f2557dc45bd40a4ec3ec884f301e014b /script/core/linker.lua
parent78899471be2e3cb1f5bda56ad5d3d8d084534515 (diff)
downloadlua-language-server-c692372d9d37be181fddb891b2a9c91cd0ac1e0d.zip
stash
Diffstat (limited to 'script/core/linker.lua')
-rw-r--r--script/core/linker.lua30
1 files changed, 22 insertions, 8 deletions
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