Skip to content

Commit

Permalink
corrected issue in table setup and check
Browse files Browse the repository at this point in the history
the loop that determines expected data type from the associated codes
needed to check that the second associated index was not -1 (which
indicates that there is no second associated index); also, the check
if the associated code has an expression information structure was
made permanent since not all associated codes have this structure

the associated codes were removed from the AssignList code since they
are not needed for the letTranslate()
  • Loading branch information
thunder422 committed Aug 25, 2013
1 parent 010789b commit 07ec1e4
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions table.cpp
Expand Up @@ -198,9 +198,6 @@ static Code Assign_AssocCode[] = {
AssignInt_Code, AssignStr_Code, AssignList_Code
};
static Code AssignLeft_AssocCode[] = {AssignKeepLeft_Code};
static Code AssignList_AssocCode[] = {
AssignListInt_Code, AssignListStr_Code
};
static Code AssignInt_AssocCode[] = {AssignListInt_Code};
static Code AssignMid2_AssocCode[] = {AssignKeepMid2_Code};
static Code AssignMid3_AssocCode[] = {AssignKeepMid3_Code};
Expand Down Expand Up @@ -750,8 +747,7 @@ static TableEntry tableEntries[] =
},
{ // AssignList_Code
Operator_TokenType, OneWord_Multiple,
"=", "AssignList", Reference_Flag, 4, Double_DataType,
new ExprInfo(Null_Code, Operands(DblDbl), AssocCode2(AssignList, 2))
"=", "AssignList", Reference_Flag, 4, Double_DataType, &DblDbl_ExprInfo
},
{ // AssignListInt_Code
Operator_TokenType, OneWord_Multiple,
Expand Down Expand Up @@ -1217,21 +1213,27 @@ QStringList Table::setupAndCheck(void)
{
int bitMask = bitMaskDataType[exprInfo->m_expectedDataType];
int index = exprInfo->m_assoc2Index;
for (; index < exprInfo->m_nAssocCodes; index++)
{
Code assocCode = exprInfo->m_assocCode[index];
ExprInfo *exprInfo2 = m_entry[assocCode].exprInfo;
if (exprInfo2 != NULL) // FIXME - remove this
bitMask |= bitMaskDataType[exprInfo2
->m_operandDataType[exprInfo2->m_nOperands - 1]];
}
if (bitMask == Num_BitMask)
{
exprInfo->m_expectedDataType = Number_DataType;
}
else if (bitMask == Any_BitMask)
if (index >= 0)
{
exprInfo->m_expectedDataType = Any_DataType;
for (; index < exprInfo->m_nAssocCodes; index++)
{
Code assocCode = exprInfo->m_assocCode[index];
ExprInfo *exprInfo2 = m_entry[assocCode].exprInfo;
if (exprInfo2 != NULL)
{
bitMask |= bitMaskDataType[exprInfo2
->m_operandDataType[exprInfo2->m_nOperands
- 1]];
}
}
if (bitMask == Num_BitMask)
{
exprInfo->m_expectedDataType = Number_DataType;
}
else if (bitMask == Any_BitMask)
{
exprInfo->m_expectedDataType = Any_DataType;
}
}
}
}
Expand Down

0 comments on commit 07ec1e4

Please sign in to comment.