summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-04-19 20:34:14 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-04-19 20:34:14 +0800
commit8df10264e72db662d68b77855f99fa886217f74a (patch)
treeb5e60ee3e4e6f1854a97dd8a59f8c80d1369fabe /script
parent6bee6ff2a79e665cb5dfa0b7263d00c67814efe2 (diff)
downloadlua-language-server-8df10264e72db662d68b77855f99fa886217f74a.zip
cleanup
Diffstat (limited to 'script')
-rw-r--r--script/core/guide.lua19
-rw-r--r--script/core/linker.lua27
2 files changed, 7 insertions, 39 deletions
diff --git a/script/core/guide.lua b/script/core/guide.lua
index ac8c5ef6..b42744ca 100644
--- a/script/core/guide.lua
+++ b/script/core/guide.lua
@@ -136,17 +136,6 @@ function m.searchRefs(status, source, mode)
end
end
- ---@param id string
- ---@param expect string
- local function checkLastID(id, expect)
- local lastID = linker.getLastID(root, id)
- if not lastID then
- return
- end
- expect = expect:sub(#lastID + 2)
- pushQueue(lastID, expect)
- end
-
local stackCount = 0
local mark = {}
search = function (id, field, flag)
@@ -167,12 +156,12 @@ function m.searchRefs(status, source, mode)
if field == nil then
m.pushResult(status, mode, eachLink.source)
end
- if flag & SEARCH_FLAG.backward == 0 then
+ --if flag & SEARCH_FLAG.backward == 0 then
checkForward(eachLink, field, flag | SEARCH_FLAG.forward)
- end
- if flag & SEARCH_FLAG.forward == 0 then
+ --end
+ --if flag & SEARCH_FLAG.forward == 0 then
checkBackward(eachLink, field, flag | SEARCH_FLAG.backward)
- end
+ --end
end
local lastID = linker.getLastID(root, id)
if lastID then
diff --git a/script/core/linker.lua b/script/core/linker.lua
index 5d20b114..d05f45c8 100644
--- a/script/core/linker.lua
+++ b/script/core/linker.lua
@@ -147,19 +147,16 @@ local function getID(source)
end
util.revertTable(IDList)
local id = table.concat(IDList, '|')
- local lastID, nextID
+ local lastID
if index > 1 then
lastID = table.concat(IDList, '|', 1, index)
- nextID = table.concat(IDList, '|', 3)
end
- return id, current, lastID, nextID
+ return id, current, lastID
end
---@class link
-- 当前节点的id
---@field id string
--- 下个节点的id
----@field nextID string
-- 上个节点的id
---@field lastID string
-- 语法树单元
@@ -177,7 +174,7 @@ end
---@param source parser.guide.object
---@return link
local function createLink(source)
- local id, node, lastID, nextID = getID(source)
+ local id, node, lastID = getID(source)
if not id then
return nil
end
@@ -185,7 +182,6 @@ local function createLink(source)
id = id,
source = source,
lastID = lastID,
- nextID = nextID,
freturn = checkFunctionReturn(node),
forward = checkForward(source),
backward = checkBackward(source),
@@ -204,9 +200,6 @@ local function insertLinker(linkers, link)
if link.lastID then
linkers.lastIDMap[id] = link.lastID
end
- if link.nextID then
- linkers.nextIDMap[id] = link.nextID
- end
end
local m = {}
@@ -247,19 +240,6 @@ function m.getLastID(root, id)
return linkers.lastIDMap[id]
end
----根据ID来获取前进的ID
----@param root parser.guide.object
----@param id string
----@return string
-function m.getNextID(root, id)
- root = guide.getRoot(root)
- local linkers = root._linkers
- if not linkers then
- return nil
- end
- return linkers.nextIDMap[id]
-end
-
---获取source的链接信息
---@param source parser.guide.object
---@return link
@@ -281,7 +261,6 @@ function m.compileLinks(source)
local linkers = {
idMap = {},
lastIDMap = {},
- nextIDMap = {},
}
guide.eachSource(root, function (src)
local link = m.getLink(src)