summaryrefslogtreecommitdiff
path: root/script/vm/generic.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-13 19:59:45 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-13 19:59:45 +0800
commitb3b71716f689be9115cdde8d6caf0314e76ae523 (patch)
treed1859d7a80d635b6157a431c1ef6f51c8a4484f0 /script/vm/generic.lua
parent43ef5d13ab20b77da3e4f7626116f0580aa1377e (diff)
downloadlua-language-server-b3b71716f689be9115cdde8d6caf0314e76ae523.zip
cleanup
Diffstat (limited to 'script/vm/generic.lua')
-rw-r--r--script/vm/generic.lua12
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