summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-12-16 17:27:11 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-12-16 17:27:11 +0800
commit42ce9ab14839c83962268a94f6be8c6b36395270 (patch)
tree7a916337e66b1baa8f4b068dc7a0a53b504791f4 /script
parent5c17a569a3e722606385d6de98c0ddc7dfd9d007 (diff)
downloadlua-language-server-42ce9ab14839c83962268a94f6be8c6b36395270.zip
must bind to node
Diffstat (limited to 'script')
-rw-r--r--script/vm/tracer.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/script/vm/tracer.lua b/script/vm/tracer.lua
index e83cfc11..b53fc33e 100644
--- a/script/vm/tracer.lua
+++ b/script/vm/tracer.lua
@@ -508,17 +508,22 @@ function mt:getNode(source)
return self.nodes[source] or nil
end
+---@class vm.node
+---@field package _tracer vm.tracer
+
---@param source parser.object
---@return vm.tracer?
local function createTracer(source)
- if source._tracer then
- return source._tracer
+ local node = vm.compileNode(source)
+ local tracer = node._tracer
+ if tracer then
+ return tracer
end
local main = guide.getParentBlock(source)
if not main then
return nil
end
- local tracer = setmetatable({
+ tracer = setmetatable({
source = source,
assigns = {},
assignMap = {},
@@ -529,7 +534,7 @@ local function createTracer(source)
main = main,
uri = guide.getUri(source),
}, mt)
- source._tracer = tracer
+ node._tracer = tracer
tracer:collectLocal()