summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/core/completion.lua2
-rw-r--r--script/core/infer.lua6
-rw-r--r--script/parser/luadoc.lua8
-rw-r--r--script/vm/getDocs.lua6
4 files changed, 12 insertions, 10 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua
index 7822cc8d..8a9e1f14 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -1267,7 +1267,7 @@ local function getCallEnums(source, index)
if doc.type == 'doc.param'
and doc.param[1] == arg[1] then
local enums = {}
- for _, enum in ipairs(vm.getDocEnums(doc.extends) or {}) do
+ for _, enum in ipairs(vm.getDocEnums(doc.extends)) do
enums[#enums+1] = {
label = enum[1],
description = enum.comment,
diff --git a/script/core/infer.lua b/script/core/infer.lua
index 0c04e0cd..528ef51a 100644
--- a/script/core/infer.lua
+++ b/script/core/infer.lua
@@ -312,8 +312,7 @@ local function getDocName(doc)
return table.concat(list, '|')
end
if doc.type == 'doc.class.name'
- or doc.type == 'doc.type.name'
- or doc.type == 'doc.alias.name' then
+ or doc.type == 'doc.type.name' then
local name = doc[1] or '?'
return name
end
@@ -329,7 +328,8 @@ local function getDocName(doc)
if doc.type == 'doc.type.function' then
return 'function'
end
- if doc.type == 'doc.type.enum' then
+ if doc.type == 'doc.type.enum'
+ or doc.type == 'doc.resume' then
local value = doc[1] or '?'
return value
end
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index b1d0a364..2d21c9ac 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -425,9 +425,10 @@ local function parseTypeUnit(parent, content)
return result
end
-local function parseResume()
+local function parseResume(parent)
local result = {
- type = 'doc.resume'
+ type = 'doc.resume',
+ parent = parent,
}
if checkToken('symbol', '>', 1) then
@@ -456,7 +457,6 @@ local function parseResume()
return result
end
-local LastType
function parseType(parent)
local result = {
type = 'doc.type',
@@ -557,7 +557,7 @@ function parseType(parent)
row = row + i + 1
local finishPos = nextComm.text:find('#', 3) or #nextComm.text
parseTokens(nextComm.text:sub(3, finishPos), nextComm.start + 1)
- local resume = parseResume()
+ local resume = parseResume(result)
if resume then
if comments then
resume.comment = table.concat(comments, '\n')
diff --git a/script/vm/getDocs.lua b/script/vm/getDocs.lua
index 9df8d4d4..54ddbe02 100644
--- a/script/vm/getDocs.lua
+++ b/script/vm/getDocs.lua
@@ -73,14 +73,16 @@ local function getDocNames(name, type)
return results
end
-function vm.getDocEnums(doc, mark, results)
+function vm.getDocEnums(doc)
if not doc then
return nil
end
local defs = searcher.requestDefinition(doc)
+ local results = {}
for _, def in ipairs(defs) do
- if def.type == 'doc.type.enum' then
+ if def.type == 'doc.type.enum'
+ or def.type == 'doc.resume' then
results[#results+1] = def
end
end