summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-06-13 20:20:46 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-06-13 20:20:46 +0800
commitfa287e75c9d4ad2ebabc1a6ceec5bbc9393a33b8 (patch)
treea22dbd9116007d08efa48f77cea147af1502fb9d /script/vm
parent4081b303684b95ec27fd833a1cd10978d4ad5e10 (diff)
downloadlua-language-server-fa287e75c9d4ad2ebabc1a6ceec5bbc9393a33b8.zip
bind overloads
fix #2083
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/compiler.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 6b4636fc..cd114bd1 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -55,6 +55,9 @@ function vm.bindDocs(source)
vm.setNode(source, vm.compileNode(ast))
return true
end
+ if doc.type == 'doc.overload' then
+ vm.setNode(source, vm.compileNode(doc))
+ end
end
return false
end
@@ -1020,6 +1023,7 @@ local function compileLocal(source)
vm.setNode(source, vm.compileNode(source.value))
end
end
+
-- function x.y(self, ...) --> function x:y(...)
if source[1] == 'self'
and not hasMarkDoc
@@ -1031,6 +1035,7 @@ local function compileLocal(source)
vm.setNode(source, vm.compileNode(setfield.node))
end
end
+
if source.parent.type == 'funcargs' and not hasMarkDoc and not hasMarkParam then
local func = source.parent.parent
-- local call ---@type fun(f: fun(x: number));call(function (x) end) --> x -> number
@@ -1055,6 +1060,7 @@ local function compileLocal(source)
vm.setNode(source, vm.declareGlobal('type', 'any'))
end
end
+
-- for x in ... do
if source.parent.type == 'in' then
compileForVars(source.parent, source)