fixed an issue in isKindOf:

This commit is contained in:
hyunghwan.chung
2017-09-30 04:49:54 +00:00
parent a240b0be7d
commit cb2b93d01c
4 changed files with 24 additions and 8 deletions

View File

@ -239,7 +239,7 @@ extend Apex
method(#class) isKindOf: aClass
{
<primitive: #_is_kind_of>
^(self isMemberOf: aClass) or: [self inheritsFrom: aClass].
^(self isMemberOf: aClass) or: [self class inheritsFrom: aClass].
}
method isMemberOf: aClass

View File

@ -54,7 +54,7 @@ class MyObject(TestObject)
method(#class) main
{
| tc limit |
(10 isKindOf: 20) dump.
tc := %(
## 0 - 4
[(Object isKindOf: Class) == true],
@ -65,12 +65,20 @@ class MyObject(TestObject)
## 5-9
[(Apex isKindOf: Class) == true],
[(Apex isKindOf: Apex) == true],
[(SmallInteger isKindOf: Integer) == false],
[(10 isKindOf: Integer) == true],
[(10 isKindOf: 20) == false],
[(Apex isMemberOf: Class) == true],
[(Class isMemberOf: Class) == true]
## 10-14
[([] isKindOf: BlockContext) == true],
[([] isKindOf: MethodContext) == false],
[([] isKindOf: Context) == true],
[('string' isKindOf: String) == true],
[(#symbol isKindOf: String) == true],
[('string' isKindOf: Symbol) == false],
[(#symbol isKindOf: Symbol) == true]
).
limit := tc size.