diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-04-24 05:05:39 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-04-24 05:05:39 +0800 |
commit | afbe46c3090e55ff08302b5306ce6dae99f09c54 (patch) | |
tree | 250d17bd9c841fc8ceb78de58637c7f555482471 /script/vm/node.lua | |
parent | e76e59948ff86f37a7b17fa79ca7041a1dae1bf8 (diff) | |
download | lua-language-server-afbe46c3090e55ff08302b5306ce6dae99f09c54.zip |
infer by `if not x or x.y then`
Diffstat (limited to 'script/vm/node.lua')
-rw-r--r-- | script/vm/node.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/script/vm/node.lua b/script/vm/node.lua index 204a149d..d3e407b6 100644 --- a/script/vm/node.lua +++ b/script/vm/node.lua @@ -10,6 +10,7 @@ vm.nodeCache = {} ---@field [integer] vm.object local mt = {} mt.__index = mt +mt.id = 0 mt.type = 'vm.node' mt.optional = nil mt.lastInfer = nil @@ -273,11 +274,16 @@ function vm.clearNodeCache() vm.nodeCache = {} end +local ID = 0 + ---@param a? vm.node | vm.object ---@param b? vm.node | vm.object ---@return vm.node function vm.createNode(a, b) - local node = setmetatable({}, mt) + ID = ID + 1 + local node = setmetatable({ + id = ID, + }, mt) if a then node:merge(a) end |