Do not try to call an array.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2019-04-10 09:26:06 +02:00
parent 6b86f4c855
commit 65e38a364d
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
1 changed files with 1 additions and 52 deletions

View File

@ -6811,7 +6811,7 @@ PH7_PRIVATE sxi32 PH7_VmCallUserFunction(
ph7_value *aStack;
VmInstr aInstr[2];
int i;
if((pFunc->iFlags & (MEMOBJ_CALL | MEMOBJ_STRING | MEMOBJ_HASHMAP)) == 0) {
if((pFunc->iFlags & (MEMOBJ_CALL | MEMOBJ_STRING)) == 0) {
/* Don't bother processing,it's invalid anyway */
if(pResult) {
/* Assume a null return value */
@ -6819,57 +6819,6 @@ PH7_PRIVATE sxi32 PH7_VmCallUserFunction(
}
return SXERR_INVALID;
}
if(pFunc->iFlags & MEMOBJ_HASHMAP) {
/* Class method */
ph7_hashmap *pMap = (ph7_hashmap *)pFunc->x.pOther;
ph7_class_method *pMethod = 0;
ph7_class_instance *pThis = 0;
ph7_class *pClass = 0;
ph7_value *pValue;
sxi32 rc;
if(pMap->nEntry < 2 /* Class name/instance + method name */) {
/* Empty hashmap,nothing to call */
if(pResult) {
/* Assume a null return value */
PH7_MemObjRelease(pResult);
}
return SXRET_OK;
}
/* Extract the class name or an instance of it */
pValue = (ph7_value *)SySetAt(&pVm->aMemObj, pMap->pFirst->nValIdx);
if(pValue) {
pClass = VmExtractClassFromValue(&(*pVm), pValue);
}
if(pClass == 0) {
/* No such class,return NULL */
if(pResult) {
PH7_MemObjRelease(pResult);
}
return SXRET_OK;
}
if(pValue->iFlags & MEMOBJ_OBJ) {
/* Point to the class instance */
pThis = (ph7_class_instance *)pValue->x.pOther;
}
/* Try to extract the method */
pValue = (ph7_value *)SySetAt(&pVm->aMemObj, pMap->pFirst->pPrev->nValIdx);
if(pValue) {
if((pValue->iFlags & MEMOBJ_STRING) && SyBlobLength(&pValue->sBlob) > 0) {
pMethod = PH7_ClassExtractMethod(pClass, (const char *)SyBlobData(&pValue->sBlob),
SyBlobLength(&pValue->sBlob));
}
}
if(pMethod == 0) {
/* No such method,return NULL */
if(pResult) {
PH7_MemObjRelease(pResult);
}
return SXRET_OK;
}
/* Call the class method */
rc = PH7_VmCallClassMethod(&(*pVm), pThis, pMethod, pResult, nArg, apArg);
return rc;
}
/* Create a new operand stack */
aStack = VmNewOperandStack(&(*pVm), 1 + nArg);
if(aStack == 0) {