From 03e3cd15f9673e13537eee9d6b71bb45c22318eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 27 Oct 2020 11:14:12 +0800 Subject: =?UTF-8?q?doc.type.function=20=E8=A7=86=E4=B8=BA=E4=B8=80?= =?UTF-8?q?=E7=A7=8D=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-beta/parser/guide.lua | 64 +++++++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 21 deletions(-) (limited to 'script-beta/parser/guide.lua') diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index cc0bcdfe..a1b73306 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -960,21 +960,28 @@ end local function stepRefOfDocType(status, obj, mode) local results = {} - local name = obj[1] - if not name or not status.interface.docType then - return results - end - local docs = status.interface.docType(name) - for i = 1, #docs do - local doc = docs[i] - if mode == 'def' then - if doc.type == 'doc.class.name' - or doc.type == 'doc.alias.name' then + if obj.type == 'doc.class.name' + or obj.type == 'doc.type.name' + or obj.type == 'doc.alias.name' + or obj.type == 'doc.extends.name' then + local name = obj[1] + if not name or not status.interface.docType then + return results + end + local docs = status.interface.docType(name) + for i = 1, #docs do + local doc = docs[i] + if mode == 'def' then + if doc.type == 'doc.class.name' + or doc.type == 'doc.alias.name' then + results[#results+1] = doc + end + else results[#results+1] = doc end - else - results[#results+1] = doc end + else + results[#results+1] = obj end return results end @@ -1456,12 +1463,21 @@ function m.checkSameSimpleByBindDocs(status, obj, start, queue, mode) newStatus.cache.searchingBindedDoc = true for _, res in ipairs(results) do local doc = m.getDocState(res) - local refs = doc.bindSources - for _, ref in ipairs(refs) do - if not mark[ref] then - mark[ref] = true - m.searchRefs(newStatus, ref, mode) + if doc.type == 'doc.class' + or doc.type == 'doc.type' then + local refs = doc.bindSources + for _, ref in ipairs(refs) do + if not mark[ref] then + mark[ref] = true + m.searchRefs(newStatus, ref, mode) + end end + else + queue[#queue+1] = { + obj = res, + start = start, + force = true, + } end end for _, res in ipairs(newStatus.results) do @@ -1853,6 +1869,8 @@ function m.pushResult(status, mode, ref, simple) results[#results+1] = ref elseif ref.type == 'library' then results[#results+1] = ref + elseif ref.type == 'doc.type.function' then + results[#results+1] = ref end if ref.parent and ref.parent.type == 'return' then if m.getParentFunction(ref) ~= m.getParentFunction(simple.first) then @@ -1888,6 +1906,8 @@ function m.pushResult(status, mode, ref, simple) end elseif ref.type == 'library' then results[#results+1] = ref + elseif ref.type == 'doc.type.function' then + results[#results+1] = ref end if ref.parent and ref.parent.type == 'return' then results[#results+1] = ref @@ -1918,6 +1938,8 @@ function m.pushResult(status, mode, ref, simple) end elseif ref.type == 'library' then results[#results+1] = ref + elseif ref.type == 'doc.type.function' then + results[#results+1] = ref end end end @@ -2672,10 +2694,10 @@ function m.inferCheckUpDoc(status, source) if source.parent.type == 'funcargs' or source.parent.type == 'in' or source.parent.type == 'loop' then - status.results[#status.results+1] = { - type = m.viewInferType(m.getDocTypeNames(doc.extends)), - source = doc, - } + local results = m.getDocTypeNames(doc.extends) + for _, res in ipairs(results) do + status.results[#status.results+1] = res + end return true end end -- cgit v1.2.3