diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-07-29 15:56:11 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-07-29 15:56:11 +0800 |
commit | 6c64d0a0b65bb7f1dbda14a91151f40e06c1adc0 (patch) | |
tree | 3f4c223103b04b7409539d7c04bc522e884a14d0 /script/parser/guide.lua | |
parent | 6c452f5c36417289f5030074ce4834783e56d06f (diff) | |
download | lua-language-server-6c64d0a0b65bb7f1dbda14a91151f40e06c1adc0.zip |
fix
Diffstat (limited to 'script/parser/guide.lua')
-rw-r--r-- | script/parser/guide.lua | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua index 0c1462ef..fe0c62f1 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -581,7 +581,11 @@ end --- 添加child function m.addChilds(list, obj) - local f = compiledChildMap[obj.type] + local tp = obj.type + if not tp then + return + end + local f = compiledChildMap[tp] if not f then return end @@ -689,22 +693,19 @@ end function m.eachSource(ast, callback) local cache = ast.eachCache if not cache then - cache = {} + cache = { ast } ast.eachCache = cache - local list = { ast } local mark = {} local index = 1 while true do - local obj = list[index] + local obj = cache[index] if not obj then - return + break end - list[index] = false - cache[index] = obj index = index + 1 if not mark[obj] then mark[obj] = true - m.addChilds(list, obj) + m.addChilds(cache, obj) end end end |