From 4ddea4e9386ab0b0ec9583e6c468b52a0d7a8958 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, 14 Jul 2021 16:49:48 +0800 Subject: fix infer of infer of `---@type {}[]` --- script/parser/luadoc.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'script') diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index acb19a25..3a3a0984 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -388,10 +388,9 @@ local function parseTypeUnitFunction() return typeUnit end -local function parseTypeUnitLiteralTable(parent) +local function parseTypeUnitLiteralTable() local typeUnit = { type = 'doc.type.ltable', - parent = parent, start = getStart(), fields = {}, } @@ -451,6 +450,9 @@ local function parseTypeUnit(parent, content) if content == 'fun' then result = parseTypeUnitFunction() end + if content == '{' then + result = parseTypeUnitLiteralTable() + end if not result then result = { type = 'doc.type.name', @@ -565,7 +567,7 @@ function parseType(parent) end elseif tp == 'symbol' and content == '{' then nextToken() - local typeUnit = parseTypeUnitLiteralTable(result) + local typeUnit = parseTypeUnit(result, content) if not typeUnit then break end -- cgit v1.2.3