summaryrefslogtreecommitdiff
path: root/script/core/linker.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-04-15 20:10:37 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-04-15 20:10:37 +0800
commitf09d553bc1570112d8e405fb0e89491fc7380bcd (patch)
tree4a1291be2c3125697063509f0c390a2f35685548 /script/core/linker.lua
parent7f1d5adae4b59857282afc969a63147618afa710 (diff)
downloadlua-language-server-f09d553bc1570112d8e405fb0e89491fc7380bcd.zip
stash
Diffstat (limited to 'script/core/linker.lua')
-rw-r--r--script/core/linker.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/script/core/linker.lua b/script/core/linker.lua
index a064deaa..64aaef1c 100644
--- a/script/core/linker.lua
+++ b/script/core/linker.lua
@@ -147,11 +147,15 @@ local function getID(source)
end
util.revertTable(IDList)
local id = table.concat(IDList, '|')
- return id, current
+ local parentID = table.concat(IDList, '|', 1, -2)
+ return id, current, parentID
end
---@class link
+-- 当前节点的id
---@field id string
+-- 父节点的id
+---@field parentID string
-- 语法树单元
---@field source parser.guide.object
-- 是否是局部变量
@@ -173,13 +177,14 @@ end
---@param source parser.guide.object
---@return link
local function createLink(source)
- local id, node = getID(source)
+ local id, node, parentID = getID(source)
if not id then
return nil
end
return {
id = id,
source = source,
+ parentID = parentID,
loc = checkLocal(node),
global = checkGlobal(node),
tfield = checkTableField(node),