diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-12-16 17:27:11 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-12-16 17:27:11 +0800 |
commit | 42ce9ab14839c83962268a94f6be8c6b36395270 (patch) | |
tree | 7a916337e66b1baa8f4b068dc7a0a53b504791f4 /script/vm | |
parent | 5c17a569a3e722606385d6de98c0ddc7dfd9d007 (diff) | |
download | lua-language-server-42ce9ab14839c83962268a94f6be8c6b36395270.zip |
must bind to node
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/tracer.lua | 13 |
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() |