From 67f0fb20a3acb616cd700a2cd77afd616a68868d 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, 26 Oct 2020 10:22:17 +0800 Subject: doc.param --- script-beta/parser/guide.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'script-beta/parser/guide.lua') diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 0e79fb08..694d37d0 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -2513,7 +2513,7 @@ function m.getDocTypeNames(doc) return results end -function m.inferByDoc(status, source) +function m.inferCheckDoc(status, source) while source.type == 'select' or source.type == 'call' do local parent = source.parent if parent.type == 'local' @@ -2545,8 +2545,18 @@ function m.inferByDoc(status, source) for _, res in ipairs(results) do status.results[#status.results+1] = res end + elseif doc.type == 'doc.param' then + if source.type == 'local' + and m.getName(source) == doc.param[1] + and source.parent.type == 'funcargs' then + status.results[#status.results+1] = { + type = m.viewInferType(m.getDocTypeNames(doc.extends)), + source = doc, + } + end end end + return true end function m.inferCheckUnary(status, source) @@ -3237,7 +3247,8 @@ function m.searchInfer(status, obj) status.cache.clock = status.cache.clock or osClock() end - local checked = m.inferCheckLibrary(status, obj) + local checked = m.inferCheckDoc(status, obj) + or m.inferCheckLibrary(status, obj) or m.inferCheckLiteral(status, obj) or m.inferCheckUnary(status, obj) or m.inferCheckBinary(status, obj) @@ -3249,7 +3260,6 @@ function m.searchInfer(status, obj) return end - m.inferByDoc(status, obj) if not status.simple then m.inferByDef(status, obj) end -- cgit v1.2.3