diff options
Diffstat (limited to 'script')
-rw-r--r-- | script/provider/diagnostic.lua | 1 | ||||
-rw-r--r-- | script/vm/compiler.lua | 13 | ||||
-rw-r--r-- | script/vm/function.lua | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua index 762b8d50..46ea600f 100644 --- a/script/provider/diagnostic.lua +++ b/script/provider/diagnostic.lua @@ -515,6 +515,7 @@ function m.diagnosticsScope(uri, force) local id = 'diagnosticsScope:' .. scp:getName() await.close(id) await.call(function () ---@async + await.sleep(0.0) m.awaitDiagnosticsScope(uri, function (fileUri) xpcall(m.doDiagnostic, log.error, fileUri, true) end) 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 -? diff --git a/script/vm/function.lua b/script/vm/function.lua index f64b2262..148211be 100644 --- a/script/vm/function.lua +++ b/script/vm/function.lua @@ -201,7 +201,7 @@ end ---@return parser.object[] function vm.getMatchedFunctions(func, args, mark) local funcs = {} - local node = vm.compileNode(func) + local node = vm.getNode(func) or vm.compileNode(func) for n in node:eachObject() do if n.type == 'function' or n.type == 'doc.type.function' then |