From ed764615146751a0a9a0d9169a84b9fb9f5248e9 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 14:44:34 +0800 Subject: cleanup --- script/parser/luadoc.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'script/parser/luadoc.lua') diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index 85215140..6f35052b 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -1114,17 +1114,25 @@ local function bindDocsBetween(sources, binded, bindSources, start, finish) end local src = sources[index] if src.start < start then - left = index + left = index + 1 else right = index end end - for i = index - 1, max do + + -- 从前往后进行绑定 + for i = index, max do local src = sources[i] if src then if src.start > finish then break end + -- 遇到table后中断,处理以下情况: + -- ---@type AAA + -- local t = {x = 1, y = 2} + if src.type == 'table' then + break + end if src.start >= start then src.bindDocs = binded bindSources[#bindSources+1] = src @@ -1220,13 +1228,10 @@ local function bindDocs(state) or src.type == 'tablefield' or src.type == 'tableindex' or src.type == 'function' + or src.type == 'table' or src.type == '...' then sources[#sources+1] = src end - if src.type == 'table' then - -- TODO - return true - end end) table.sort(sources, function (a, b) return a.start < b.start -- cgit v1.2.3