diff options
-rw-r--r-- | script/parser/guide.lua | 8 | ||||
-rw-r--r-- | script/parser/luadoc.lua | 3 | ||||
-rw-r--r-- | test/definition/luadoc.lua | 10 |
3 files changed, 11 insertions, 10 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua index 1bda2d32..73857149 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -928,7 +928,7 @@ function m.getKeyName(obj) or tp == 'tableindex' then return m.getKeyNameOfLiteral(obj.index) elseif tp == 'tableexp' then - return tostring(obj.tindex) + return obj.tindex elseif tp == 'field' or tp == 'method' or tp == 'doc.see.field' then @@ -938,11 +938,11 @@ function m.getKeyName(obj) elseif tp == 'doc.alias' then return obj.alias[1] elseif tp == 'doc.field' then - return tostring(obj.field[1]) + return obj.field[1] elseif tp == 'doc.field.name' then - return tostring(obj[1]) + return obj[1] elseif tp == 'doc.type.field' then - return tostring(obj.name[1]) + return obj.name[1] elseif tp == 'dummy' then return obj[1] end diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index 5b9bdfad..9b041870 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -224,6 +224,7 @@ local function parseIndexField(tp, parent) return nil end nextToken() + local start = getFinish() - 1 local indexTP, index = peekToken() if indexTP == 'name' then local field = parseType(parent) @@ -233,7 +234,7 @@ local function parseIndexField(tp, parent) nextToken() local class = { type = tp, - start = getStart(), + start = start, finish = getFinish(), parent = parent, } diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index c7c67bb6..97b12b85 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -822,22 +822,22 @@ print(t.<?x?>) TEST [[ ---@class A ----@field <![1]!>? boolean +---@field [1]? <!{}!> local t -print(t[<?1?>]) +local <!<?v?>!> = t[1] ]] TEST [[ ----@type { <![1]?: boolean!> } +---@type { [1]?: <!{}!> } local t -print(t[<?1?>]) +local <!<?v?>!> = t[1] ]] TEST [[ ---@class A ----@field <!['xx']!>? boolean +---@field <!['xx']!>? <!{}!> local t print(t.<?xx?>) |