diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-04-13 19:59:45 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-04-13 19:59:45 +0800 |
commit | b3b71716f689be9115cdde8d6caf0314e76ae523 (patch) | |
tree | d1859d7a80d635b6157a431c1ef6f51c8a4484f0 /script/vm/generic.lua | |
parent | 43ef5d13ab20b77da3e4f7626116f0580aa1377e (diff) | |
download | lua-language-server-b3b71716f689be9115cdde8d6caf0314e76ae523.zip |
cleanup
Diffstat (limited to 'script/vm/generic.lua')
-rw-r--r-- | script/vm/generic.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/script/vm/generic.lua b/script/vm/generic.lua index 37d2bd13..b3981ff8 100644 --- a/script/vm/generic.lua +++ b/script/vm/generic.lua @@ -1,5 +1,3 @@ -local nodeMgr = require 'vm.node' -local union = require 'vm.union' local vm = require 'vm.vm' ---@class parser.object @@ -14,7 +12,7 @@ mt.type = 'generic' ---@param source parser.object ---@param resolved? table<string, vm.node> ----@return parser.object | vm.union +---@return parser.object | vm.node local function cloneObject(source, resolved) if not resolved then return source @@ -28,7 +26,9 @@ local function cloneObject(source, resolved) parent = source.parent, [1] = source[1], } - nodeMgr.setNode(newName, resolved[key], true) + if resolved[key] then + vm.setNode(newName, resolved[key], true) + end return newName end if source.type == 'doc.type' then @@ -118,8 +118,8 @@ end function mt:resolve(uri, args) local resolved = self.sign:resolve(uri, args) local protoNode = vm.compileNode(self.proto) - local result = union() - for nd in nodeMgr.eachObject(protoNode) do + local result = vm.createNode() + for nd in protoNode:eachObject() do local clonedNode = vm.compileNode(cloneObject(nd, resolved)) result:merge(clonedNode) end |