AerScript supports multiple inheritance, thus it needs to iterate through whole list of derived classes.
The build was successful.
Details
The build was successful.
Details
This commit is contained in:
parent
4d1c246a65
commit
2d50a64cac
31
engine/vm.c
31
engine/vm.c
|
@ -6402,7 +6402,8 @@ static int VmQueryInterfaceSet(ph7_class *pClass, SySet *pSet) {
|
||||||
* Otherwise FALSE is returned.
|
* Otherwise FALSE is returned.
|
||||||
*/
|
*/
|
||||||
static int VmInstanceOf(ph7_class *pThis, ph7_class *pClass) {
|
static int VmInstanceOf(ph7_class *pThis, ph7_class *pClass) {
|
||||||
ph7_class *pParent;
|
SyHashEntry *pEntry;
|
||||||
|
ph7_class *pDerived, *pParent;
|
||||||
sxi32 rc;
|
sxi32 rc;
|
||||||
if(pThis == pClass) {
|
if(pThis == pClass) {
|
||||||
/* Instance of the same class */
|
/* Instance of the same class */
|
||||||
|
@ -6413,20 +6414,34 @@ static int VmInstanceOf(ph7_class *pThis, ph7_class *pClass) {
|
||||||
if(rc) {
|
if(rc) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
/* Check parent classes */
|
/* Check derived classes */
|
||||||
pParent = pThis->pBase;
|
SyHashResetLoopCursor(&pThis->hDerived);
|
||||||
while(pParent) {
|
while((pEntry = SyHashGetNextEntry(&pThis->hDerived)) != 0) {
|
||||||
if(pParent == pClass) {
|
pDerived = (ph7_class *) pEntry->pUserData;
|
||||||
|
if(pDerived == pClass) {
|
||||||
/* Same instance */
|
/* Same instance */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
/* Check the implemented interfaces */
|
/* Check the implemented interfaces */
|
||||||
rc = VmQueryInterfaceSet(pClass, &pParent->aInterface);
|
rc = VmQueryInterfaceSet(pClass, &pDerived->aInterface);
|
||||||
if(rc) {
|
if(rc) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
/* Point to the parent class */
|
/* Check parent classes */
|
||||||
pParent = pParent->pBase;
|
pParent = pDerived->pBase;
|
||||||
|
while(pParent) {
|
||||||
|
if(pParent == pClass) {
|
||||||
|
/* Same instance */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
/* Check the implemented interfaces */
|
||||||
|
rc = VmQueryInterfaceSet(pClass, &pParent->aInterface);
|
||||||
|
if(rc) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
/* Point to the parent class */
|
||||||
|
pParent = pParent->pBase;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Not an instance of the the given class */
|
/* Not an instance of the the given class */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Reference in New Issue