diff options
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/diagnostics/circle-doc-class.lua | 32 | ||||
-rw-r--r-- | script/core/diagnostics/undefined-doc-class.lua | 37 | ||||
-rw-r--r-- | script/core/hover/label.lua | 10 |
3 files changed, 44 insertions, 35 deletions
diff --git a/script/core/diagnostics/circle-doc-class.lua b/script/core/diagnostics/circle-doc-class.lua index 7ef76603..f3721fd9 100644 --- a/script/core/diagnostics/circle-doc-class.lua +++ b/script/core/diagnostics/circle-doc-class.lua @@ -28,21 +28,23 @@ return function (uri, callback) goto CONTINUE end if current.extends then - local newName = current.extends[1] - if newName == myName then - callback { - start = doc.start, - finish = doc.finish, - message = lang.script('DIAG_CIRCLE_DOC_CLASS', myName) - } - goto CONTINUE - end - if not mark[newName] then - mark[newName] = true - local docs = vm.getDocTypes(newName) - for _, otherDoc in ipairs(docs) do - if otherDoc.type == 'doc.class.name' then - list[#list+1] = otherDoc.parent + for _, extend in ipairs(current.extends) do + local newName = extend[1] + if newName == myName then + callback { + start = doc.start, + finish = doc.finish, + message = lang.script('DIAG_CIRCLE_DOC_CLASS', myName) + } + goto CONTINUE + end + if not mark[newName] then + mark[newName] = true + local docs = vm.getDocTypes(newName) + for _, otherDoc in ipairs(docs) do + if otherDoc.type == 'doc.class.name' then + list[#list+1] = otherDoc.parent + end end end end diff --git a/script/core/diagnostics/undefined-doc-class.lua b/script/core/diagnostics/undefined-doc-class.lua index 8e0be20a..7d23971a 100644 --- a/script/core/diagnostics/undefined-doc-class.lua +++ b/script/core/diagnostics/undefined-doc-class.lua @@ -20,28 +20,29 @@ return function (uri, callback) } for _, doc in ipairs(state.ast.docs) do if doc.type == 'doc.class' then - local ext = doc.extends - if not ext then + if not doc.extends then goto CONTINUE end - local name = ext[1] - local docs = vm.getDocTypes(name) - if cache[name] == nil then - cache[name] = false - for _, otherDoc in ipairs(docs) do - if otherDoc.type == 'doc.class.name' then - cache[name] = true - break + for _, ext in ipairs(doc.extends) do + local name = ext[1] + local docs = vm.getDocTypes(name) + if cache[name] == nil then + cache[name] = false + for _, otherDoc in ipairs(docs) do + if otherDoc.type == 'doc.class.name' then + cache[name] = true + break + end end end - end - if not cache[name] then - callback { - start = ext.start, - finish = ext.finish, - related = cache, - message = lang.script('DIAG_UNDEFINED_DOC_CLASS', name) - } + if not cache[name] then + callback { + start = ext.start, + finish = ext.finish, + related = cache, + message = lang.script('DIAG_UNDEFINED_DOC_CLASS', name) + } + end end end ::CONTINUE:: diff --git a/script/core/hover/label.lua b/script/core/hover/label.lua index a82a09ea..dd309c41 100644 --- a/script/core/hover/label.lua +++ b/script/core/hover/label.lua @@ -126,16 +126,22 @@ local function asDocField(source) break end end + local infers = {} + for _, ext in ipairs(source.extends) do + for _, infer in ipairs(vm.getInfers(ext) or {}) do + infers[#infers+1] = infer + end + end if not class then return ('field ?.%s: %s'):format( name, - vm.getInferType(source.extends) + guide.viewInferType(infers) ) end return ('field %s.%s: %s'):format( class.class[1], name, - vm.getInferType(source.extends) + guide.viewInferType(infers) ) end |