summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-08-08 14:23:47 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-08-08 14:23:47 +0800
commit624afbf6ead64798a9fbb936eddeb179e8089e3f (patch)
treeeade282dbee14e399c92c07b020c12bb36a79965 /server
parent957693a43162559719dba79b67f9cd03a56f0f86 (diff)
downloadlua-language-server-624afbf6ead64798a9fbb936eddeb179e8089e3f.zip
#72 check nil
Diffstat (limited to 'server')
-rw-r--r--server/src/emmy/manager.lua6
-rw-r--r--server/test/full/normal.lua5
2 files changed, 9 insertions, 2 deletions
diff --git a/server/src/emmy/manager.lua b/server/src/emmy/manager.lua
index fc7180bd..d7edbadb 100644
--- a/server/src/emmy/manager.lua
+++ b/server/src/emmy/manager.lua
@@ -100,9 +100,11 @@ function mt:addType(source)
for i, obj in ipairs(source) do
local typeUnit = newTypeUnit(self, obj)
local className = obj[1]
- local list = self:getClass(className)
+ if className then
+ local list = self:getClass(className)
+ list[source.id] = typeUnit
+ end
typeUnit:setParent(typeObj)
- list[source.id] = typeUnit
typeObj._childs[i] = typeUnit
obj:set('emmy.typeUnit', typeUnit)
end
diff --git a/server/test/full/normal.lua b/server/test/full/normal.lua
index facc0139..a673e74b 100644
--- a/server/test/full/normal.lua
+++ b/server/test/full/normal.lua
@@ -150,3 +150,8 @@ end
TEST [[
local x = ,
]]
+
+TEST [[
+---@type any|fun():nil
+local t
+]]