summaryrefslogtreecommitdiff
path: root/server-beta/src/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-15 14:58:01 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-15 14:58:01 +0800
commit69522a194a1e0c9a8263a985782d48fe1cc8690b (patch)
tree9f051b0515b7bfb8edd1a3b4e5a4acee11d305c4 /server-beta/src/parser
parenta0d017be1128485b189c24d47fdd087ae19602cb (diff)
downloadlua-language-server-69522a194a1e0c9a8263a985782d48fe1cc8690b.zip
优化 getLinks
Diffstat (limited to 'server-beta/src/parser')
-rw-r--r--server-beta/src/parser/guide.lua12
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