summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-18 22:45:45 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-18 22:45:45 +0800
commitec09f57b1adbb9a258bc4a68741cce678c7c77e7 (patch)
tree93eaa25bd5a30e0f4c84e4cb93ebe2cd79c000f7 /script
parent0cd6426b466cefddb29a6f5255d89e5191df232e (diff)
downloadlua-language-server-ec09f57b1adbb9a258bc4a68741cce678c7c77e7.zip
stash
Diffstat (limited to 'script')
-rw-r--r--script/vm/compiler.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 44d51daa..80180bce 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -898,14 +898,17 @@ local compilerSwitch = util.switch()
end)
: case 'getlocal'
: call(function (source)
+ vm.compileNode(source.node)
+
local lastLoc = source.node
for _, ref in ipairs(source.node.ref) do
- if ref.type == 'setlocal' then
-
+ if ref.type == 'setlocal'
+ and (ref.range or ref.start) < source.start then
+ lastLoc = ref
end
end
- vm.setNode(source, vm.compileNode(lastLoc))
+ vm.setNode(source, vm.getNode(lastLoc))
end)
: case 'setfield'
: case 'setmethod'