From f09d553bc1570112d8e405fb0e89491fc7380bcd 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, 15 Apr 2021 20:10:37 +0800 Subject: stash --- script/core/linker.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'script/core/linker.lua') 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), -- cgit v1.2.3