summaryrefslogtreecommitdiff
path: root/script/vm/compiler.lua
diff options
context:
space:
mode:
authorfesily <fesil@foxmail.com>2024-01-17 19:28:26 +0800
committerGitHub <noreply@github.com>2024-01-17 19:28:26 +0800
commitdd49a6dd6afc35a14fba3b675a2d9f1ee2bb7ca4 (patch)
treec338f21a68e1efc2b86c4746cdd81ff5892c6431 /script/vm/compiler.lua
parent326a033a816f0bd5dcca6aeea1443935ee5a9e3c (diff)
parent34319c7990cba47ddc00e77aabfccbb923f84e26 (diff)
downloadlua-language-server-dd49a6dd6afc35a14fba3b675a2d9f1ee2bb7ca4.zip
Merge branch 'master' into plugin-OnNodeCompileFunctionParam
Diffstat (limited to 'script/vm/compiler.lua')
-rw-r--r--script/vm/compiler.lua29
1 files changed, 29 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 6b8b76cd..4621006e 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -1091,6 +1091,35 @@ local function compileLocal(source)
end
end
end
+ if not hasDocArg
+ and func.parent.type == 'local' then
+ local refs = func.parent.ref
+ local findCall
+ if refs then
+ for i, ref in ipairs(refs) do
+ if ref.parent.type == 'call' then
+ findCall = ref.parent
+ break
+ end
+ end
+ end
+ if findCall and findCall.args then
+ local index
+ for i, arg in ipairs(source.parent) do
+ if arg == source then
+ index = i
+ break
+ end
+ end
+ if index then
+ local callerArg = findCall.args[index]
+ if callerArg then
+ hasDocArg = true
+ vm.setNode(source, vm.compileNode(callerArg))
+ end
+ end
+ end
+ end
if not hasDocArg then
local suc, node = plugin.dispatch("OnNodeCompileFunctionParam", guide.getUri(source), source)
if suc and node then