summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-28 15:29:18 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-28 15:29:18 +0800
commit75b8b11130cb3baae68082eaa49ecef9a8570e3a (patch)
tree495771883c3077f3a9a309297ebbbc77e1ff546b /script/vm
parent599b44716801aea385e5726a37c788cdf674f78a (diff)
downloadlua-language-server-75b8b11130cb3baae68082eaa49ecef9a8570e3a.zip
special treat `local x; x = function() end`
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/compiler.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index c249b44d..b2cdb1be 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -1008,6 +1008,17 @@ local function compileLocal(source)
vm.setNode(source, vm.compileNode(source.value))
end
end
+ if not hasMarkValue and not hasMarkValue then
+ if source.ref then
+ for _, ref in ipairs(source.ref) do
+ if ref.type == 'setlocal'
+ and ref.value
+ and ref.value.type == 'function' then
+ vm.setNode(source, vm.compileNode(ref.value))
+ end
+ end
+ end
+ end
-- function x.y(self, ...) --> function x:y(...)
if source[1] == 'self'
and not hasMarkDoc