Skip to content

Commit 6b882c9

Browse files
committed
cleanup
1 parent e711f30 commit 6b882c9

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

script/vm/node.lua

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ function mt:remove(name)
227227
or (c.type == 'doc.type.boolean' and name == 'false' and c[1] == false)
228228
or (c.type == 'doc.type.table' and name == 'table')
229229
or (c.type == 'doc.type.array' and name == 'table')
230-
or (c.type == 'doc.type.sign' and name == 'table')
230+
or (c.type == 'doc.type.sign' and name == c.node[1])
231231
or (c.type == 'doc.type.function' and name == 'function') then
232232
table.remove(self, index)
233233
self[c] = nil
@@ -248,7 +248,7 @@ function mt:narrow(name)
248248
or (c.type == 'doc.type.boolean' and name == 'boolean')
249249
or (c.type == 'doc.type.table' and name == 'table')
250250
or (c.type == 'doc.type.array' and name == 'table')
251-
or (c.type == 'doc.type.sign' and name == 'table')
251+
or (c.type == 'doc.type.sign' and name == c.node[1])
252252
or (c.type == 'doc.type.function' and name == 'function') then
253253
goto CONTINUE
254254
end
@@ -337,10 +337,15 @@ function mt:asTable()
337337
local c = self[index]
338338
if c.type == 'table'
339339
or c.type == 'doc.type.table'
340-
or c.type == 'doc.type.array'
341-
or c.type == 'doc.type.sign' then
340+
or c.type == 'doc.type.array' then
342341
goto CONTINUE
343342
end
343+
if c.type == 'doc.type.sign' then
344+
if c.node[1] == 'table'
345+
or not guide.isBasicType(c.node[1]) then
346+
goto CONTINUE
347+
end
348+
end
344349
if c.type == 'global' and c.cate == 'type' then
345350
---@cast c vm.global
346351
if c.name == 'table'

script/vm/type.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,16 +259,16 @@ end
259259
---@param uri uri
260260
---@param tnode vm.node
261261
---@param vnode vm.node|string|vm.object
262-
---@param inversion? boolean
262+
---@param reverse? boolean
263263
---@return vm.node?
264-
function vm.getTableKey(uri, tnode, vnode, inversion)
264+
function vm.getTableKey(uri, tnode, vnode, reverse)
265265
local result = vm.createNode()
266266
for tn in tnode:eachObject() do
267267
if tn.type == 'doc.type.table' then
268268
for _, field in ipairs(tn.fields) do
269269
if field.name.type ~= 'doc.field.name'
270270
and field.extends then
271-
if inversion then
271+
if reverse then
272272
if vm.isSubType(uri, vm.compileNode(field.extends), vnode) then
273273
result:merge(vm.compileNode(field.name))
274274
end

0 commit comments

Comments
 (0)