diff options
Diffstat (limited to 'script/vm/infer.lua')
-rw-r--r-- | script/vm/infer.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/script/vm/infer.lua b/script/vm/infer.lua index 00f1b014..b9dfb29a 100644 --- a/script/vm/infer.lua +++ b/script/vm/infer.lua @@ -534,11 +534,11 @@ end ---@return string|number|boolean|nil function vm.viewKey(source, uri) if source.type == 'doc.type' then - if #source == 1 then - return vm.viewKey(source[1], uri) + if #source.types == 1 then + return vm.viewKey(source.types[1], uri) else local key = vm.viewObject(source, uri) - return '[' .. key .. ']', key + return '[' .. key .. ']' end end if source.type == 'tableindex' then @@ -564,6 +564,9 @@ function vm.viewKey(source, uri) if source.type == 'doc.type.field' then return vm.viewKey(source.name, uri) end + if source.type == 'doc.type.name' then + return '[' .. source[1] .. ']' + end local key = vm.getKeyName(source) if key == nil then return nil |