mirror of
https://github.com/flynx/Slang.git
synced 2025-10-29 18:50:08 +00:00
some cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
1393c03f5b
commit
c3d57ce9a8
@ -375,13 +375,14 @@
|
|||||||
// equivalent to instanceof:
|
// equivalent to instanceof:
|
||||||
|
|
||||||
function isInstanceOf(obj, proto){
|
function isInstanceOf(obj, proto){
|
||||||
return proto instanceof Function
|
return obj === Function && proto === Function ? true
|
||||||
|
: (isInstanceOf(proto, Function)
|
||||||
&& (obj.__proto__ === proto.prototype ? true
|
&& (obj.__proto__ === proto.prototype ? true
|
||||||
// NOTE: the last in this chain is Object.prototype.__proto__
|
// NOTE: the last in this chain is Object.prototype.__proto__
|
||||||
// and it is null
|
// and it is null
|
||||||
: obj.__proto__ == null ? false
|
: obj.__proto__ == null ? false
|
||||||
// go down the chain...
|
// go down the chain...
|
||||||
: isInstanceOf(obj.__proto__, proto))
|
: isInstanceOf(obj.__proto__, proto)))
|
||||||
}
|
}
|
||||||
|
|
||||||
isInstanceOf(c, C) // -> true
|
isInstanceOf(c, C) // -> true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user