diff options
Diffstat (limited to 'script/core/linker.lua')
-rw-r--r-- | script/core/linker.lua | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/script/core/linker.lua b/script/core/linker.lua new file mode 100644 index 00000000..6c475e70 --- /dev/null +++ b/script/core/linker.lua @@ -0,0 +1,31 @@ +local guide = require 'parser.guide' + +local function getKey(source) + if source.type == 'local' then + return ('l%d%s'):format(source.start, source[1]) + end +end + +---创建source的链接信息 +local function createLink(source) + local idList = {} + if getKey then + idList[#idList+1] = getKey(source) + end + local id = table.concat(idList, '|') + return { + id = id, + } +end + +local m = {} + +---获取source的链接信息 +function m.getLink(source) + if not source._link then + source._link = createLink(source) + end + return source._link +end + +return m |