Skip to content
Snippets Groups Projects
Commit 35aa1dab authored by 最萌小汐's avatar 最萌小汐
Browse files

improve

parent e0cc99cf
No related branches found
No related tags found
Loading
......@@ -363,8 +363,6 @@ local function getNodeKey(source)
return key, node
end
local IDList = {}
local IDList2 = {}
---获取语法树单元的字符串ID
---@param source parser.guide.object
---@return string? id
......@@ -383,38 +381,26 @@ local function getID(source)
tracy.ZoneBeginN 'getID'
local _ <close> = tracy.ZoneEnd
local current = source
local index = 0
while true do
if current.type == 'paren' then
while current.type == 'paren' do
current = current.exp
if not current then
source._id = false
return nil
end
goto CONTINUE
end
local id, node = getNodeKey(current)
if not id then
break
end
index = index + 1
IDList[index] = id
if not node then
break
end
current = node
::CONTINUE::
end
if index == 0 then
source._id = false
return nil
end
for i = index + 1, #IDList2 do
IDList2[i] = nil
if node then
local pid = getID(node)
if not pid then
source._id = false
return nil
end
for i = 1, index do
IDList2[i] = IDList[index - i + 1]
id = pid .. SPLIT_CHAR .. id
end
local id = tconcat(IDList2, SPLIT_CHAR)
source._id = id
return id
end
......@@ -1427,6 +1413,6 @@ files.watch(function (ev, uri)
end
end)
--require 'tracy'.enable()
require 'tracy'.enable()
return m
......@@ -91,7 +91,7 @@ local function main()
--config.Lua.intelliSense.searchDepth = 5
--loadDocMetas()
--test 'full'
test 'full'
require 'bee.platform'.OS = 'Windows'
testAll()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment