Set the proper type of array.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2018-10-26 19:45:10 +02:00
parent 03cf969c31
commit 6f13c347d8
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
1 changed files with 14 additions and 1 deletions

View File

@ -2414,6 +2414,7 @@ static sxi32 VmByteCodeExec(
* stack and insert them (key => value pair) in the new hashmap. * stack and insert them (key => value pair) in the new hashmap.
*/ */
case PH7_OP_LOAD_MAP: { case PH7_OP_LOAD_MAP: {
sxi32 iFlags, pFlags;
ph7_hashmap *pMap; ph7_hashmap *pMap;
/* Allocate a new hashmap instance */ /* Allocate a new hashmap instance */
pMap = PH7_NewHashmap(&(*pVm), 0, 0); pMap = PH7_NewHashmap(&(*pVm), 0, 0);
@ -2423,6 +2424,7 @@ static sxi32 VmByteCodeExec(
} }
if(pInstr->iP1 > 0) { if(pInstr->iP1 > 0) {
ph7_value *pEntry = &pTos[-pInstr->iP1 + 1]; /* Point to the first entry */ ph7_value *pEntry = &pTos[-pInstr->iP1 + 1]; /* Point to the first entry */
iFlags = pEntry[1].iFlags; /* Save the type of value */
/* Perform the insertion */ /* Perform the insertion */
while(pEntry < pTos) { while(pEntry < pTos) {
if(pEntry[1].iFlags & MEMOBJ_REFERENCE) { if(pEntry[1].iFlags & MEMOBJ_REFERENCE) {
@ -2438,6 +2440,17 @@ static sxi32 VmByteCodeExec(
&pEntry[1] &pEntry[1]
); );
} }
/* Set the proper type of array */
if((iFlags & MEMOBJ_MIXED) == 0) {
if(pEntry[1].iFlags & MEMOBJ_REFERENCE) {
pFlags = pEntry[1].iFlags ^ MEMOBJ_REFERENCE;
} else {
pFlags = pEntry[1].iFlags;
}
if(iFlags != pFlags) {
iFlags = MEMOBJ_MIXED;
}
}
/* Next pair on the stack */ /* Next pair on the stack */
pEntry += 2; pEntry += 2;
} }
@ -2448,7 +2461,7 @@ static sxi32 VmByteCodeExec(
pTos++; pTos++;
pTos->nIdx = SXU32_HIGH; pTos->nIdx = SXU32_HIGH;
pTos->x.pOther = pMap; pTos->x.pOther = pMap;
MemObjSetType(pTos, MEMOBJ_HASHMAP); MemObjSetType(pTos, MEMOBJ_HASHMAP | iFlags);
break; break;
} }
/* /*