diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-12 17:41:00 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-12 17:41:00 +0800 |
commit | 55dc0cc8a8d6fe6893aac8ab0a150a1fd6001aba (patch) | |
tree | 3ae749678d6ccf0fd33c892122a8b7621e9ea4b1 /server/src/vm/value.lua | |
parent | 894db9dc2125acdfe9ef69759bf7709d25552eef (diff) | |
download | lua-language-server-55dc0cc8a8d6fe6893aac8ab0a150a1fd6001aba.zip |
整理代码
Diffstat (limited to 'server/src/vm/value.lua')
-rw-r--r-- | server/src/vm/value.lua | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua index f41d30e0..3cbccdd0 100644 --- a/server/src/vm/value.lua +++ b/server/src/vm/value.lua @@ -23,6 +23,7 @@ local function create (tp, source, literal) _type = {}, _literal = literal, _info = {}, + _infoCheck = 10, }, mt) if type(tp) == 'table' then for i = 1, #tp do @@ -246,7 +247,7 @@ function mt:addInfo(tp, source, ...) if self._info[source] then return end - if not source then + if not source or not source.isRemoved then return end local info = { @@ -256,6 +257,22 @@ function mt:addInfo(tp, source, ...) } self._info[#self._info+1] = info self._info[info.source] = true + + -- 清除无效的info + --if #self._info > self._infoCheck then + -- for i = #self._info, 1, -1 do + -- local info = self._info[i] + -- local src = info.source + -- if src:isRemoved() then + -- table.remove(self._info, i) + -- self._info[src] = nil + -- end + -- end + -- self._infoCheck = #self._info * 2 + -- if self._infoCheck < 10 then + -- self._infoCheck = 10 + -- end + --end end function mt:eachInfo(callback) |