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