From 507bb6852f6ae523dca4370c38cac8581329a2c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 27 May 2021 15:40:43 +0800 Subject: generic param --- script/core/infer.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'script/core') diff --git a/script/core/infer.lua b/script/core/infer.lua index 2578aac4..ce89a6c9 100644 --- a/script/core/infer.lua +++ b/script/core/infer.lua @@ -327,7 +327,11 @@ local function getDocName(doc) if doc.type == 'doc.class.name' or doc.type == 'doc.type.name' then local name = doc[1] or '?' - return name + if doc.typeGeneric then + return '<' .. name .. '>' + else + return name + end end if doc.type == 'doc.type.array' then local nodeName = getDocName(doc.node) or '?' @@ -478,6 +482,17 @@ function m.searchInfers(source, field) searchInfer(def, infers) end end + if source.docParam then + local docType = source.docParam.extends + if docType.type == 'doc.type' then + for _, def in ipairs(docType.types) do + if def.typeGeneric and not mark[def] then + mark[def] = true + searchInfer(def, infers) + end + end + end + end cleanInfers(infers) return infers end -- cgit v1.2.3