summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-01 16:10:26 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-01 16:10:33 +0800
commit87e0a180f97cd6bc31909b60228f1148c0289529 (patch)
treeda72f156113a156b960018ec352196823fe28649 /script/vm
parentcbcac3afc40268eae82a41a82248d912b1cfeeb6 (diff)
downloadlua-language-server-87e0a180f97cd6bc31909b60228f1148c0289529.zip
#1260 `type.weakNilCheck`
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/type.lua12
1 files changed, 5 insertions, 7 deletions
diff --git a/script/vm/type.lua b/script/vm/type.lua
index 399cbffc..ac3b8986 100644
--- a/script/vm/type.lua
+++ b/script/vm/type.lua
@@ -62,20 +62,18 @@ function vm.isSubType(uri, child, parent, mark)
return true
end
end
- if child:isOptional() then
- if vm.isSubType(uri, 'nil', parent, mark) then
- return true
- end
- end
return false
else
+ local weakNil = config.get(uri, 'Lua.type.weakNilCheck')
for n in child:eachObject() do
- if getNodeName(n)
+ local nodeName = getNodeName(n)
+ if nodeName
+ and not (nodeName == 'nil' and weakNil)
and not vm.isSubType(uri, n, parent, mark) then
return false
end
end
- if child:isOptional() then
+ if not weakNil and child:isOptional() then
if not vm.isSubType(uri, 'nil', parent, mark) then
return false
end