summaryrefslogtreecommitdiff
path: root/server/src/matcher/vm.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-14 10:47:26 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-14 10:47:26 +0800
commitd41b3171483c54d6e5f4a2ce31d232cd19415dda (patch)
tree8b8c3628ab68483f9bb411981bf4f53d27426818 /server/src/matcher/vm.lua
parent74eb4a1c35e3a959078f8c55e00fab1aabdc7356 (diff)
downloadlua-language-server-d41b3171483c54d6e5f4a2ce31d232cd19415dda.zip
修正报错
Diffstat (limited to 'server/src/matcher/vm.lua')
-rw-r--r--server/src/matcher/vm.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua
index 8997812d..c10e0067 100644
--- a/server/src/matcher/vm.lua
+++ b/server/src/matcher/vm.lua
@@ -61,10 +61,12 @@ function mt:addInfo(obj, type, source)
return obj
end
-function mt:createDots(source)
+function mt:createDots(index, source)
local dots = {
type = 'dots',
source = source or DefaultSource,
+ func = self:getCurrentFunction(),
+ index = index,
}
self.chunk.dots = dots
return dots
@@ -267,8 +269,7 @@ function mt:buildFunction(exp, object)
func.args[#func.args+1] = var
func.argValues[#func.args] = self:getValue(var)
elseif arg.type == '...' then
- local dots = self:createDots(arg)
- func.args[#func.args+1] = dots
+ self:createDots(#func.args+1, arg)
stop = true
end
end)
@@ -771,7 +772,7 @@ end
function mt:getDots()
if not self.chunk.dots then
- self:createDots()
+ self:createDots(1)
end
return self.chunk.dots
end
@@ -1011,7 +1012,7 @@ function mt:createEnvironment()
-- _ENV 有个特殊标记
envValue.ENV = true
-- 隐藏的参数`...`
- self:createDots()
+ self:createDots(1)
-- 设置全局变量
for name, lib in pairs(library.global) do