mirror of
https://github.com/kikito/middleclass.git
synced 2024-11-08 09:34:22 +00:00
fixed isInstanceOf
This commit is contained in:
parent
219550cd58
commit
1be9e39deb
@ -126,12 +126,13 @@ end
|
|||||||
function Object.static:subclassed(other) end
|
function Object.static:subclassed(other) end
|
||||||
|
|
||||||
function Object.static:isSubclassOf(other)
|
function Object.static:isSubclassOf(other)
|
||||||
if type(other) ~= 'table' or
|
return type(other) == 'table' and
|
||||||
type(self) ~= 'table' or
|
type(self) == 'table' and
|
||||||
type(self.super) ~= 'table' or
|
type(self.super) == 'table' and
|
||||||
type(self.super.isSubclassOf) ~= 'function' then return false end
|
( self.super == other or
|
||||||
|
type(self.super.isSubclassOf) == 'function' and
|
||||||
return self.super == other or self.super:isSubclassOf(other)
|
self.super:isSubclassOf(other)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Object.static:include( ... )
|
function Object.static:include( ... )
|
||||||
@ -145,12 +146,13 @@ function Object:initialize() end
|
|||||||
function Object:__tostring() return "instance of " .. tostring(self.class) end
|
function Object:__tostring() return "instance of " .. tostring(self.class) end
|
||||||
|
|
||||||
function Object:isInstanceOf(aClass)
|
function Object:isInstanceOf(aClass)
|
||||||
if type(self) ~= 'table' or
|
return type(self) == 'table' and
|
||||||
type(self.class) ~= 'table' or
|
type(self.class) == 'table' and
|
||||||
type(aClass) ~= 'table' or
|
type(aClass) == 'table' and
|
||||||
type(aClass.isSubclassOf) ~= 'function' then return false end
|
( aClass == self.class or
|
||||||
|
type(aClass.isSubclassOf) == 'function' and
|
||||||
return aClass == self.class or aClass:isSubclassOf(self.class)
|
self.class:isSubclassOf(aClass)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function includes(mixin, aClass)
|
function includes(mixin, aClass)
|
||||||
|
Loading…
Reference in New Issue
Block a user