summaryrefslogtreecommitdiff
path: root/server/src/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-05 14:46:05 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-05 14:46:05 +0800
commit908738e65b6af347f051d7b4439d4820efa60605 (patch)
tree7f7c4224af85630b908e3829b04aad8cbfd43a8f /server/src/vm
parente5131f6964d22e26cfcc6075e547666452df699c (diff)
downloadlua-language-server-908738e65b6af347f051d7b4439d4820efa60605.zip
支持对象call的hover
Diffstat (limited to 'server/src/vm')
-rw-r--r--server/src/vm/function.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/server/src/vm/function.lua b/server/src/vm/function.lua
index 8eebb59c..976f8ab2 100644
--- a/server/src/vm/function.lua
+++ b/server/src/vm/function.lua
@@ -158,7 +158,9 @@ function mt:run()
end
function mt:setArgs(values)
- self.argValues = {}
+ for i = 1, #self.argValues do
+ self.argValues[i] = nil
+ end
for i = 1, #values do
self.argValues[i] = values[i]
end
@@ -171,7 +173,7 @@ function mt:createArg(arg, values)
self:saveLocal(arg[1], loc)
self.args[#self.args+1] = loc
elseif arg.type == '...' then
- self._dots = createMulti(values)
+ self._dots = createMulti()
for i = 1, #values do
self._dots:set(i, values[i])
end
@@ -201,8 +203,10 @@ function mt:createArgs()
if not args then
return
end
- local values = self.argValues or {}
- self.argValues = nil
+ local values = {}
+ for i, value in ipairs(self.argValues) do
+ values[i] = value
+ end
if args.type == 'list' then
for _, arg in ipairs(args) do
self:createArg(arg, values)
@@ -231,6 +235,7 @@ return function (source)
source = source,
locals = {},
args = {},
+ argValues = {},
}, mt)
self:push()
return self