diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-11-15 14:58:01 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-11-15 14:58:01 +0800 |
commit | 69522a194a1e0c9a8263a985782d48fe1cc8690b (patch) | |
tree | 9f051b0515b7bfb8edd1a3b4e5a4acee11d305c4 /server-beta/src/parser | |
parent | a0d017be1128485b189c24d47fdd087ae19602cb (diff) | |
download | lua-language-server-69522a194a1e0c9a8263a985782d48fe1cc8690b.zip |
优化 getLinks
Diffstat (limited to 'server-beta/src/parser')
-rw-r--r-- | server-beta/src/parser/guide.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/server-beta/src/parser/guide.lua b/server-beta/src/parser/guide.lua index c141feb5..c96f7143 100644 --- a/server-beta/src/parser/guide.lua +++ b/server-beta/src/parser/guide.lua @@ -357,8 +357,16 @@ end --- 获取指定的 special function m.eachSpecialOf(ast, name, callback) - if not ast.special then - + local root = m.getRoot(ast) + if not root.specials then + return + end + local specials = root.specials[name] + if not specials then + return + end + for i = 1, #specials do + callback(specials[i]) end end |