summaryrefslogtreecommitdiff
path: root/server/src/core/diagnostics.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/core/diagnostics.lua')
-rw-r--r--server/src/core/diagnostics.lua27
1 files changed, 20 insertions, 7 deletions
diff --git a/server/src/core/diagnostics.lua b/server/src/core/diagnostics.lua
index d49f8da2..0732b7e3 100644
--- a/server/src/core/diagnostics.lua
+++ b/server/src/core/diagnostics.lua
@@ -439,10 +439,6 @@ function mt:checkEmmyClass(source, callback)
local related = {}
local current = class
for _ = 1, 10 do
- if parent:getName() == class:getName() then
- callback(source.start, source.finish, lang.script.DIAG_CYCLIC_EXTENDS, related)
- break
- end
local extends = current.extends
if not extends then
break
@@ -452,20 +448,37 @@ function mt:checkEmmyClass(source, callback)
finish = current:getSource().finish,
uri = current:getSource().uri,
}
- current = parent
- parent = self.vm.emmyMgr:eachClass(extends, function (parent)
+ current = self.vm.emmyMgr:eachClass(extends, function (parent)
return parent
end)
- if not parent then
+ if not current then
+ break
+ end
+ if current:getName() == class:getName() then
+ callback(source.start, source.finish, lang.script.DIAG_CYCLIC_EXTENDS, related)
break
end
end
end
+function mt:checkEmmyType(source, callback)
+ for _, tpsource in ipairs(source) do
+ local name = tpsource[1]
+ local class = self.vm.emmyMgr:eachClass(name, function (class)
+ return class
+ end)
+ if not class then
+ callback(tpsource.start, tpsource.finish, lang.script.DIAG_UNDEFINED_CLASS)
+ end
+ end
+end
+
function mt:searchEmmyLua(callback)
self.vm:eachSource(function (source)
if source.type == 'emmyClass' then
self:checkEmmyClass(source, callback)
+ elseif source.type == 'emmyType' then
+ self:checkEmmyType(source, callback)
end
end)
end