summaryrefslogtreecommitdiff
path: root/script-beta/vm/vm.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-08-16 02:35:14 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-08-16 02:35:14 +0800
commit36b69f2c7f11e337897d282a10151548cb8876ea (patch)
treee3f5ced6617da4018648a415ae0c519fd74de61d /script-beta/vm/vm.lua
parentc3cec6c8cd20c319c291431fbec55f1d1d596c6d (diff)
downloadlua-language-server-36b69f2c7f11e337897d282a10151548cb8876ea.zip
暂时屏蔽类型推断
Diffstat (limited to 'script-beta/vm/vm.lua')
-rw-r--r--script-beta/vm/vm.lua18
1 files changed, 11 insertions, 7 deletions
diff --git a/script-beta/vm/vm.lua b/script-beta/vm/vm.lua
index 85df007f..d5028bdc 100644
--- a/script-beta/vm/vm.lua
+++ b/script-beta/vm/vm.lua
@@ -143,15 +143,19 @@ end
m.cacheTracker = setmetatable({}, { __mode = 'kv' })
+function m.flushCache()
+ if m.cache then
+ m.cache.dead = true
+ end
+ m.cacheVersion = files.globalVersion
+ m.cache = {}
+ m.locked = setmetatable({}, { __mode = 'k' })
+ m.cacheTracker[m.cache] = true
+end
+
function m.getCache(name)
if m.cacheVersion ~= files.globalVersion then
- if m.cache then
- m.cache.dead = true
- end
- m.cacheVersion = files.globalVersion
- m.cache = {}
- m.locked = setmetatable({}, { __mode = 'k' })
- m.cacheTracker[m.cache] = true
+ m.flushCache()
end
if not m.cache[name] then
m.cache[name] = {}