From 755ecb36a18ed32d2409597441e590f68774e7d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 16 Nov 2020 21:20:52 +0800 Subject: =?UTF-8?q?=E4=BF=AE=E6=94=B9infer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-beta/parser/guide.lua | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'script-beta') diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 925ee9ab..06e6949c 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -3725,18 +3725,35 @@ function m.inferByPCallReturn(status, source) end function m.cleanInfers(infers) - local mark = {} + local hasDoc for i = 1, #infers do local infer = infers[i] - if not infer then - return + if infer.source.type == 'doc.class' + or infer.source.type == 'doc.type.name' then + hasDoc = true end - local key = ('%s|%p'):format(infer.type, infer.source) - if mark[key] then - infers[i] = infers[#infers] - infers[#infers] = nil - else - mark[key] = true + end + if hasDoc then + for i = #infers, 1, -1 do + local infer = infers[i] + if infer.source.type == 'doc.class' + or infer.source.type == 'doc.type.name' then + else + infers[i] = infers[#infers] + infers[#infers] = nil + end + end + else + local mark = {} + for i = #infers, 1, -1 do + local infer = infers[i] + local key = ('%s|%p'):format(infer.type, infer.source) + if mark[key] then + infers[i] = infers[#infers] + infers[#infers] = nil + else + mark[key] = true + end end end end -- cgit v1.2.3