summaryrefslogtreecommitdiff
path: root/script/vm/compiler.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-08-01 15:39:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-08-01 15:39:13 +0800
commitc2340047debdfa00c1946a113008f7982f68dcb7 (patch)
tree9d388739cb0809f7fc93f0ed1ff1610d3328e7f8 /script/vm/compiler.lua
parentf18a56604200f7ac19a785f6ce52cb7be67979e6 (diff)
downloadlua-language-server-c2340047debdfa00c1946a113008f7982f68dcb7.zip
fix #1418
Diffstat (limited to 'script/vm/compiler.lua')
-rw-r--r--script/vm/compiler.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index a33eee1f..150ed16f 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -6,6 +6,8 @@ local files = require 'files'
---@class vm
local vm = require 'vm.vm'
+local LOCK = {}
+
---@class parser.object
---@field _compiledNodes boolean
---@field _node vm.node
@@ -1161,6 +1163,15 @@ local compilerSwitch = util.switch()
vm.setNode(src, vm.createNode(src.value))
vm.setNode(src, node:copy():asTable())
else
+ guide.eachSource(src.value, function (child)
+ if child.type == 'getlocal'
+ and child.node == source then
+ return
+ end
+ if LOCK[child] then
+ vm.removeNode(child)
+ end
+ end)
vm.setNode(src, vm.compileNode(src.value), true)
end
else
@@ -1811,9 +1822,11 @@ function vm.compileNode(source)
---@cast source parser.object
vm.setNode(source, vm.createNode(), true)
+ LOCK[source] = true
compileByGlobal(source)
compileByNode(source)
matchCall(source)
+ LOCK[source] = nil
local node = vm.getNode(source)
---@cast node -?