summaryrefslogtreecommitdiff
path: root/script/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-04 02:06:48 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-04 02:06:48 +0800
commita310a975e80978714685586c0ff4fcf5aeb6e746 (patch)
treee8110a30390a08ea3c85ef527930839208de582c /script/parser
parent2dfed8a4aabd66c98777d37245ef5482b5ffdd48 (diff)
downloadlua-language-server-a310a975e80978714685586c0ff4fcf5aeb6e746.zip
stash
Diffstat (limited to 'script/parser')
-rw-r--r--script/parser/guide.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index cb10efa2..b783a9e1 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -1090,16 +1090,20 @@ function m.getPath(a, b, sameFunction)
local pathB = {}
for _ = 1, 1000 do
objA = m.getParentBlock(objA)
- pathA[#pathA+1] = objA
- if (not sameFunction and objA.type == 'function') or objA.type == 'main' then
- break
+ if objA then
+ pathA[#pathA+1] = objA
+ if (not sameFunction and objA.type == 'function') or objA.type == 'main' then
+ break
+ end
end
end
for _ = 1, 1000 do
objB = m.getParentBlock(objB)
- pathB[#pathB+1] = objB
- if (not sameFunction and objA.type == 'function') or objB.type == 'main' then
- break
+ if objB then
+ pathB[#pathB+1] = objB
+ if (not sameFunction and objB.type == 'function') or objB.type == 'main' then
+ break
+ end
end
end
-- pathA: {1, 2, 3, 4, 5}