summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-23 00:42:10 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-23 00:42:10 +0800
commitec1f746a71dfb981f093bf00322db75d559fd6b6 (patch)
tree71730d2de455bf7cd8a9481a554a56cddf47f341 /script/vm
parent6e00db5b51646ad91c5ee5598897cad7f8d65915 (diff)
downloadlua-language-server-ec1f746a71dfb981f093bf00322db75d559fd6b6.zip
fix optional parameters
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/node.lua6
-rw-r--r--script/vm/ref.lua2
2 files changed, 6 insertions, 2 deletions
diff --git a/script/vm/node.lua b/script/vm/node.lua
index 92604c3c..b57fa80b 100644
--- a/script/vm/node.lua
+++ b/script/vm/node.lua
@@ -100,9 +100,13 @@ function mt:isNullable()
if self.optional then
return true
end
+ if #self == 0 then
+ return true
+ end
for _, c in ipairs(self) do
if c.type == 'nil'
- or (c.type == 'global' and c.cate == 'type' and c.name == 'nil') then
+ or (c.type == 'global' and c.cate == 'type' and c.name == 'nil')
+ or (c.type == 'global' and c.cate == 'type' and c.name == 'any') then
return true
end
end
diff --git a/script/vm/ref.lua b/script/vm/ref.lua
index 65e8fdab..29ea27c5 100644
--- a/script/vm/ref.lua
+++ b/script/vm/ref.lua
@@ -291,7 +291,7 @@ end
---@async
---@param source parser.object
----@param fileNotify fun(uri: uri): boolean
+---@param fileNotify? fun(uri: uri): boolean
function vm.getRefs(source, fileNotify)
local results = {}
local mark = {}