diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-26 16:20:31 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-26 16:20:31 +0800 |
commit | 7a74219cc543dc2b25a5831e8a9f22a63909cd75 (patch) | |
tree | dc6126bdde9e8314999da2f92396ed906749e1ba /server/src/vm/function.lua | |
parent | 637253ee878d80add56c09ea5ecf3369e99cc40e (diff) | |
download | lua-language-server-7a74219cc543dc2b25a5831e8a9f22a63909cd75.zip |
统计存活的函数
Diffstat (limited to 'server/src/vm/function.lua')
-rw-r--r-- | server/src/vm/function.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/server/src/vm/function.lua b/server/src/vm/function.lua index 5b7d8682..8e2478ca 100644 --- a/server/src/vm/function.lua +++ b/server/src/vm/function.lua @@ -3,6 +3,8 @@ local valueMgr = require 'vm.value' local localMgr = require 'vm.local' local sourceMgr = require 'vm.source' +local Watch = setmetatable({}, {__mode = 'kv'}) + local mt = {} mt.__index = mt mt.type = 'function' @@ -267,7 +269,7 @@ function mt:getSource() return sourceMgr.list[self.source] end -return function (source) +local function create(source) local id if source then id = source.id @@ -283,5 +285,11 @@ return function (source) argValues = {}, }, mt) self:push(source) + Watch[self] = true return self end + +return { + create = create, + watch = Watch, +} |