summaryrefslogtreecommitdiff
path: root/server/src/vm/function.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-26 16:20:31 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-26 16:20:31 +0800
commit7a74219cc543dc2b25a5831e8a9f22a63909cd75 (patch)
treedc6126bdde9e8314999da2f92396ed906749e1ba /server/src/vm/function.lua
parent637253ee878d80add56c09ea5ecf3369e99cc40e (diff)
downloadlua-language-server-7a74219cc543dc2b25a5831e8a9f22a63909cd75.zip
统计存活的函数
Diffstat (limited to 'server/src/vm/function.lua')
-rw-r--r--server/src/vm/function.lua10
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,
+}