Fix and document TypeCompatible
parent
b56cd11c98
commit
0165e8f348
|
@ -97,9 +97,9 @@ bool TypeCompatible(CBotTypResult& type1, CBotTypResult& type2, int op)
|
||||||
if (max == 99) return false; // result is void?
|
if (max == 99) return false; // result is void?
|
||||||
|
|
||||||
// special case for strin concatenation
|
// special case for strin concatenation
|
||||||
if (op == ID_ADD && max >= CBotTypString) return true;
|
if (op == ID_ADD && t1 == CBotTypString) return true;
|
||||||
if (op == ID_ASSADD && max >= CBotTypString) return true;
|
if (op == ID_ASSADD && t2 == CBotTypString) return true;
|
||||||
if (op == ID_ASS && t1 == CBotTypString) return true;
|
if (op == ID_ASS && t2 == CBotTypString) return true;
|
||||||
|
|
||||||
if (max >= CBotTypBoolean)
|
if (max >= CBotTypBoolean)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,13 @@ CBotInstr* CompileParams(CBotToken* &p, CBotCStack* pStack, CBotVar** ppVars);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief TypeCompatible Check if two results are consistent to make an
|
* \brief TypeCompatible Check if two results are consistent to make an
|
||||||
* operation.
|
* operation. TypeCompatible is used in two ways:
|
||||||
|
* For non-assignment operations: see CBotTwoOpExpr::Compile
|
||||||
|
* TypeCompatible( leftType, rightType, opType )
|
||||||
|
|
||||||
|
* For assignment or compound assignment operations (it's reversed):
|
||||||
|
* see CBotReturn::Compile & CBotExpression::Compile
|
||||||
|
* TypeCompatible( valueType, varType, opType )
|
||||||
* \param type1
|
* \param type1
|
||||||
* \param type2
|
* \param type2
|
||||||
* \param op
|
* \param op
|
||||||
|
|
Loading…
Reference in New Issue