summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-14 17:28:07 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-14 17:28:07 +0800
commit8cde753ce395356a87db21221a90de60eb13be5a (patch)
tree9092329ad985f7ac6f85a96543fe0ea2147f8c60 /server/src
parent657c25016e7c76012e21ff0729cd6c3bd6703ee5 (diff)
downloadlua-language-server-8cde753ce395356a87db21221a90de60eb13be5a.zip
修正in的解析bug
Diffstat (limited to 'server/src')
-rw-r--r--server/src/matcher/vm.lua21
1 files changed, 6 insertions, 15 deletions
diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua
index df722501..36634710 100644
--- a/server/src/matcher/vm.lua
+++ b/server/src/matcher/vm.lua
@@ -553,7 +553,7 @@ function mt:getLibValue(lib, parentType, v)
elseif tp == 'nil' then
value = self:createValue('nil')
else
- value = self:createValue(tp)
+ value = self:createValue(tp or 'any')
end
self.libraryValue[lib] = value
value.lib = lib
@@ -610,7 +610,9 @@ function mt:unpackDots(res, expect)
end
function mt:unpackList(list, expect)
- local res = {}
+ local res = {
+ type = 'list',
+ }
if list.type == 'list' or list.type == 'call' then
for i, exp in ipairs(list) do
if exp.type == '...' then
@@ -948,21 +950,10 @@ function mt:doLoop(action)
end
function mt:doIn(action)
- local func
- local list = {
- type = 'list'
- }
- if action.exp.type == 'list' then
- func = self:getExp(action.exp[1])
- for i = 2, #action.exp do
- list[i-1] = action.exp[i]
- end
- else
- func = self:getExp(action.exp)
- end
+ local args = self:unpackList(action.exp)
self.scope:push()
- local args = self:unpackList(list)
+ local func = table.remove(args, 1) or self:createValue('any')
local values = self:call(func, args)
self:forList(action.arg, function (arg)
local value = table.remove(values, 1)