From 83427096a606baedebb7c59af4e525e8a290f1eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 30 Dec 2020 18:11:43 +0800 Subject: clean up code --- script/parser/luadoc.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'script/parser') diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index 94544218..647a6bed 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -915,6 +915,7 @@ local function buildLuaDoc(comment) type = 'doc.comment', start = comment.start, finish = comment.finish, + range = comment.finish, comment = comment, } end @@ -924,6 +925,7 @@ local function buildLuaDoc(comment) parseTokens(doc, comment.start + startPos - 1) local result = convertTokens() if result then + result.range = comment.finish local cstart = text:find('%S', result.finish - comment.start + 2) if cstart and cstart < comment.finish then result.comment = { @@ -935,7 +937,17 @@ local function buildLuaDoc(comment) end end - return result + if result then + return result + end + + return { + type = 'doc.comment', + start = comment.start, + finish = comment.finish, + range = comment.finish, + comment = comment, + } end ---当前行在注释doc前是否有代码 -- cgit v1.2.3