diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-12-08 21:45:31 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-12-08 21:45:31 +0800 |
commit | 2e15bfac358e80df819354f0e2a2ba12cc9c93cc (patch) | |
tree | 116013a37e4882123d04c48241ca851e9c5db44e /script/vm/global.lua | |
parent | f3ad9225ae04dae2f9ee295709fc623587b1b4e8 (diff) | |
download | lua-language-server-2e15bfac358e80df819354f0e2a2ba12cc9c93cc.zip |
cleanup
Diffstat (limited to 'script/vm/global.lua')
-rw-r--r-- | script/vm/global.lua | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/script/vm/global.lua b/script/vm/global.lua index 37b54349..15c52b44 100644 --- a/script/vm/global.lua +++ b/script/vm/global.lua @@ -7,7 +7,6 @@ local ws = require 'workspace' local vm = require 'vm.vm' ---@class vm.global.link ----@field gets parser.object[] ---@field sets parser.object[] ---@class vm.global @@ -31,20 +30,6 @@ function mt:addSet(uri, source) self.setsCache = nil end ----@param uri uri ----@param source parser.object -function mt:addGet(uri, source) - if PREVIEW then - return - end - local link = self.links[uri] - if not link.gets then - link.gets = {} - end - link.gets[#link.gets+1] = source - self.getsCache = nil -end - ---@param suri uri ---@return parser.object[] function mt:getSets(suri) @@ -96,35 +81,6 @@ function mt:getAllSets() return cache end ----@return parser.object[] -function mt:getGets(suri) - if not self.getsCache then - self.getsCache = {} - end - local scp = scope.getScope(suri) - local cacheUri = scp.uri or '<callback>' - if self.getsCache[cacheUri] then - return self.getsCache[cacheUri] - end - local clock = os.clock() - self.getsCache[cacheUri] = {} - local cache = self.getsCache[cacheUri] - for uri, link in pairs(self.links) do - if link.gets then - if scp:isVisible(uri) then - for _, source in ipairs(link.gets) do - cache[#cache+1] = source - end - end - end - end - local cost = os.clock() - clock - if cost > 0.1 then - log.warn('global-manager getGets costs', cost, self.name) - end - return cache -end - ---@param uri uri function mt:dropUri(uri) self.links[uri] = nil @@ -218,7 +174,6 @@ local compilerGlobalSwitch = util.switch() return end local global = vm.declareGlobal('variable', name, uri) - global:addGet(uri, source) source._globalNode = global local nxt = source.next @@ -276,7 +231,6 @@ local compilerGlobalSwitch = util.switch() end local uri = guide.getUri(source) local global = vm.declareGlobal('variable', name, uri) - global:addGet(uri, source) source._globalNode = global local nxt = source.next @@ -301,8 +255,6 @@ local compilerGlobalSwitch = util.switch() if source.node.special == 'rawset' then global:addSet(uri, source) source.value = source.args[3] - else - global:addGet(uri, source) end source._globalNode = global @@ -401,7 +353,6 @@ local compilerGlobalSwitch = util.switch() return end local type = vm.declareGlobal('type', name, uri) - type:addGet(uri, source) source._globalNode = type end) : case 'doc.extends.name' @@ -409,7 +360,6 @@ local compilerGlobalSwitch = util.switch() local uri = guide.getUri(source) local name = source[1] local class = vm.declareGlobal('type', name, uri) - class:addGet(uri, source) source._globalNode = class end) |