summaryrefslogtreecommitdiff
path: root/script/core/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-02-20 17:35:41 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-02-20 17:35:41 +0800
commit430424201fd104ee0e2dcdbf35a8d049a19a3a95 (patch)
treed02dc105e40dd14c7ee47e2de4c76c47470c3c4d /script/core/diagnostics
parent58ae26985b85315c8fb9f79a88e84515f71c0af6 (diff)
downloadlua-language-server-430424201fd104ee0e2dcdbf35a8d049a19a3a95.zip
close #254 supports multiple class inheritance
Diffstat (limited to 'script/core/diagnostics')
-rw-r--r--script/core/diagnostics/circle-doc-class.lua32
-rw-r--r--script/core/diagnostics/undefined-doc-class.lua37
2 files changed, 36 insertions, 33 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::