summaryrefslogtreecommitdiff
path: root/server/src/vm/value.lua
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-04-16 17:45:15 +0800
committersumneko <sumneko@hotmail.com>2019-04-16 17:45:15 +0800
commit4dc47156c80ef19b8649c603a8f9f1f5e0e66ba8 (patch)
treec7838e0e4982e182fc7879b3665c2302d6862a6d /server/src/vm/value.lua
parent2c185dc55131dd7ccd490e53b5f44c48461687fe (diff)
downloadlua-language-server-4dc47156c80ef19b8649c603a8f9f1f5e0e66ba8.zip
修正一个泄露:全局函数的返回值需要标记为全局
Diffstat (limited to 'server/src/vm/value.lua')
-rw-r--r--server/src/vm/value.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua
index c93fda90..2a1c14d1 100644
--- a/server/src/vm/value.lua
+++ b/server/src/vm/value.lua
@@ -446,6 +446,9 @@ end
function mt:setFunction(func)
self._func = func.id
+ if self._global then
+ func:markGlobal()
+ end
end
function mt:getFunction()
@@ -502,6 +505,10 @@ function mt:markGlobal()
self:rawEach(function (index, value)
value:markGlobal()
end)
+ local func = self:getFunction()
+ if func then
+ func:markGlobal()
+ end
end
function mt:isGlobal()