prevented the _is_kind_of primitive handler from returning an error

This commit is contained in:
hyunghwan.chung 2017-09-29 15:12:01 +00:00
parent 303b49270d
commit a240b0be7d
3 changed files with 7 additions and 4 deletions

View File

@ -54,7 +54,7 @@ class MyObject(TestObject)
method(#class) main method(#class) main
{ {
| tc limit | | tc limit |
(10 isKindOf: 20) dump.
tc := %( tc := %(
## 0 - 4 ## 0 - 4
[(Object isKindOf: Class) == true], [(Object isKindOf: Class) == true],
@ -63,9 +63,11 @@ class MyObject(TestObject)
[(Class isKindOf: Apex) == true], [(Class isKindOf: Apex) == true],
[(Class isKindOf: Object) == false], [(Class isKindOf: Object) == false],
## 5-9
[(Apex isKindOf: Class) == true], [(Apex isKindOf: Class) == true],
[(SmallInteger isKindOf: Integer) == false], [(SmallInteger isKindOf: Integer) == false],
[(10 isKindOf: Integer) == true], [(10 isKindOf: Integer) == true],
[(10 isKindOf: 20) == false],
[(Apex isMemberOf: Class) == true], [(Apex isMemberOf: Class) == true],
[(Class isMemberOf: Class) == true] [(Class isMemberOf: Class) == true]

View File

@ -2105,9 +2105,8 @@ static moo_pfrc_t pf_is_kind_of (moo_t* moo, moo_ooi_t nargs)
rcv = MOO_STACK_GETRCV(moo, nargs); rcv = MOO_STACK_GETRCV(moo, nargs);
_class = MOO_STACK_GETARG(moo, nargs, 0); _class = MOO_STACK_GETARG(moo, nargs, 0);
MOO_PF_CHECK_ARGS (moo, nargs, MOO_CLASSOF(moo, _class) == moo->_class); if (MOO_CLASSOF(moo, _class) == moo->_class &&
moo_iskindof(moo, rcv, (moo_oop_class_t)_class))
if (moo_iskindof(moo, rcv, (moo_oop_class_t)_class))
{ {
MOO_STACK_SETRET (moo, nargs, moo->_true); MOO_STACK_SETRET (moo, nargs, moo->_true);
} }

View File

@ -978,6 +978,8 @@ int moo_iskindof (moo_t* moo, moo_oop_t obj, moo_oop_class_t _class)
{ {
moo_oop_class_t c; moo_oop_class_t c;
MOO_ASSERT (moo, MOO_CLASSOF(moo,_class) == moo->_class);
c = MOO_CLASSOF(moo,obj); /* c := self class */ c = MOO_CLASSOF(moo,obj); /* c := self class */
if (c == moo->_class) if (c == moo->_class)
{ {