summaryrefslogtreecommitdiff
path: root/script/core/linker.lua
diff options
context:
space:
mode:
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),