diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-08-16 00:09:54 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-08-16 00:09:54 +0800 |
commit | 51592cb52f944d8b22ce0a7e1ac1a940a4aef735 (patch) | |
tree | 20d6a02fe7ecc5d2d0b239afd702e488d84920a9 /script-beta/parser | |
parent | 643bdff2713f8d0ac0b9bfd781e35fa2246a1c6d (diff) | |
download | lua-language-server-51592cb52f944d8b22ce0a7e1ac1a940a4aef735.zip |
从业务层获取缓存
Diffstat (limited to 'script-beta/parser')
-rw-r--r-- | script-beta/parser/guide.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 55aa339a..faa77745 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -1736,9 +1736,30 @@ function m.cleanResults(results) end end +function m.getCache(status, obj, mode) + if not status.interface.cache then + return + end + if obj.type == 'getglobal' + or obj.type == 'setglobal' then + local name = m.getKeyName(obj) + return status.interface.cache(name, mode) + else + return status.interface.cache(obj, mode) + end +end + function m.searchRefs(status, obj, mode) status.depth = status.depth + 1 + local cache, makeCache = m.getCache(status, obj, mode) + if cache then + for i = 1, #cache do + status.results[#status.results+1] = cache[i] + end + return + end + -- 检查单步引用 local res = m.getStepRef(obj, mode) if res then @@ -1759,6 +1780,10 @@ function m.searchRefs(status, obj, mode) status.depth = status.depth - 1 m.cleanResults(status.results) + + if makeCache then + makeCache(status.results) + end end function m.searchRefOfValue(status, obj) |