summaryrefslogtreecommitdiff
path: root/script/vm/generic.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-11-06 22:58:11 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-11-06 22:58:11 +0800
commit9be846d86c494e08d376aa465e8269796176765a (patch)
tree04027cdb5ae6a118739a92911dbbd6797a39939f /script/vm/generic.lua
parentdcca81c4fa7bd9b745123be8be0c8b07fcd6e29a (diff)
downloadlua-language-server-9be846d86c494e08d376aa465e8269796176765a.zip
type check: check the fields in table
resolve #1434
Diffstat (limited to 'script/vm/generic.lua')
-rw-r--r--script/vm/generic.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/script/vm/generic.lua b/script/vm/generic.lua
index 4981f48a..e6b47392 100644
--- a/script/vm/generic.lua
+++ b/script/vm/generic.lua
@@ -3,6 +3,7 @@ local vm = require 'vm.vm'
---@class parser.object
---@field package _generic vm.generic
+---@field package _resolved vm.node
---@class vm.generic
---@field sign vm.sign
@@ -29,6 +30,7 @@ local function cloneObject(source, resolved)
}
if resolved[key] then
vm.setNode(newName, resolved[key], true)
+ newName._resolved = resolved[key]
end
return newName
end
@@ -137,6 +139,15 @@ function mt:resolve(uri, args)
end
---@param source parser.object
+---@return vm.node?
+function vm.getGenericResolved(source)
+ if source.type ~= 'doc.generic.name' then
+ return nil
+ end
+ return source._resolved
+end
+
+---@param source parser.object
---@param generic vm.generic
function vm.setGeneric(source, generic)
source._generic = generic