summaryrefslogtreecommitdiff
path: root/script/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-04-14 20:13:00 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-04-14 20:13:00 +0800
commitede808fe32a66ac828762818bf43d18fc343c159 (patch)
treea4cc8808fff798ea3bfd7103fb56bfb1d74f9c9c /script/parser
parentbabe8e194576b0cd2ede04d98417a5f0e2a23647 (diff)
downloadlua-language-server-ede808fe32a66ac828762818bf43d18fc343c159.zip
stash
Diffstat (limited to 'script/parser')
-rw-r--r--script/parser/guide.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index 2369e84f..46c32f3a 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -293,10 +293,19 @@ end
---@param obj parser.guide.object
---@return parser.guide.object
function m.getRoot(obj)
+ local source = obj
+ if source._root then
+ return source._root
+ end
for _ = 1, 1000 do
if obj.type == 'main' then
+ source._root = obj
return obj
end
+ if obj._root then
+ source._root = obj._root
+ return source._root
+ end
local parent = obj.parent
if not parent then
return nil