diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-07-14 16:49:48 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-07-14 16:49:48 +0800 |
commit | 4ddea4e9386ab0b0ec9583e6c468b52a0d7a8958 (patch) | |
tree | b58dc78883973aeea2e4ee5d113c441454497582 /script | |
parent | 113ddccfec2264eb0c500a396bb4bb7ec6729373 (diff) | |
download | lua-language-server-4ddea4e9386ab0b0ec9583e6c468b52a0d7a8958.zip |
fix infer of infer of `---@type {}[]`
Diffstat (limited to 'script')
-rw-r--r-- | script/parser/luadoc.lua | 8 |
1 files changed, 5 insertions, 3 deletions
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 |