summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2022-03-11 02:54:36 +0800
committersumneko <sumneko@hotmail.com>2022-03-11 02:54:36 +0800
commitbb02090e9f63355cda301a66571da9d2cd141334 (patch)
tree0baa80f28f442bee7e474c69e3c063f3dec276f6 /script
parentc979f901d19440c6f2cdc899ea38e7c9dc204405 (diff)
downloadlua-language-server-bb02090e9f63355cda301a66571da9d2cd141334.zip
update
Diffstat (limited to 'script')
-rw-r--r--script/vm/compiler.lua10
-rw-r--r--script/vm/infer.lua4
-rw-r--r--script/vm/sign.lua7
3 files changed, 12 insertions, 9 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index da38c334..eda85f83 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -165,9 +165,9 @@ local function getObjectSign(source)
if not source._sign then
return false
end
- for _, doc in ipairs(source.bindDocs) do
- if doc.type == 'doc.param' then
- source._sign:addSign(doc.extends)
+ if source.args then
+ for _, arg in ipairs(source.args) do
+ source._sign:addSign(m.compileNode(arg))
end
end
end
@@ -183,7 +183,7 @@ local function getObjectSign(source)
source._sign = signMgr()
if source.type == 'doc.type.function' then
for _, arg in ipairs(source.args) do
- source._sign:addSign(arg.extends)
+ source._sign:addSign(m.compileNode(arg.extends))
end
end
end
@@ -262,7 +262,7 @@ local function getReturn(func, index, args)
if returnNode and returnNode.type == 'generic' then
returnNode = returnNode:resolve(args)
end
- if returnNode then
+ if returnNode and returnNode.type ~= 'doc.generic.name' then
result = result or union()
result:merge(m.compileNode(returnNode))
end
diff --git a/script/vm/infer.lua b/script/vm/infer.lua
index f393306c..47553517 100644
--- a/script/vm/infer.lua
+++ b/script/vm/infer.lua
@@ -60,6 +60,10 @@ local viewNodeMap = util.switch()
return source[1]
end
end)
+ : case 'doc.generic.name'
+ : call(function (source, options)
+ return ('<%s>'):format(source[1])
+ end)
: case 'doc.type.array'
: call(function (source, options)
options['hasClass'] = true
diff --git a/script/vm/sign.lua b/script/vm/sign.lua
index aa1cf110..74b59347 100644
--- a/script/vm/sign.lua
+++ b/script/vm/sign.lua
@@ -8,10 +8,9 @@ local mt = {}
mt.__index = mt
mt.type = 'sign'
----@param key parser.object
-function mt:addSign(key)
- local compiler = require 'vm.compiler'
- self.signList[#self.signList+1] = compiler.compileNode(key)
+---@param node vm.node
+function mt:addSign(node)
+ self.signList[#self.signList+1] = node
end
---@param argNodes vm.node[]