| 16819 | |
| 16820 | |
| 16821 | BOOL TokenToBOOL(ExprTokenType &aToken) |
| 16822 | { |
| 16823 | switch (aToken.symbol) |
| 16824 | { |
| 16825 | case SYM_INTEGER: // Probably the most common; e.g. both sides of "if (x>3 and x<6)" are the number 1/0. |
| 16826 | return aToken.value_int64 != 0; // Force it to be purely 1 or 0. |
| 16827 | case SYM_VAR: |
| 16828 | return VarToBOOL(*aToken.var); |
| 16829 | case SYM_FLOAT: |
| 16830 | return aToken.value_double != 0.0; |
| 16831 | case SYM_STRING: |
| 16832 | return ResultToBOOL(aToken.marker); |
| 16833 | default: |
| 16834 | // The only remaining valid symbol is SYM_OBJECT, which is always TRUE. |
| 16835 | return TRUE; |
| 16836 | } |
| 16837 | } |
| 16838 | |
| 16839 | |
| 16840 |
no test coverage detected