| 10594 | |
| 10595 | |
| 10596 | ResultType Line::EvaluateCondition() |
| 10597 | // Returns CONDITION_TRUE or CONDITION_FALSE (FAIL is returned only in DEBUG mode). |
| 10598 | { |
| 10599 | #ifdef _DEBUG |
| 10600 | if (mActionType != ACT_IF) |
| 10601 | return LineError(_T("DEBUG: EvaluateCondition() was called with a line that isn't a condition.")); |
| 10602 | #endif |
| 10603 | |
| 10604 | // The following is ordered for short-circuit performance. |
| 10605 | Var *var = mArg[0].type == ARG_TYPE_INPUT_VAR ? VAR(mArg[0]) : nullptr; |
| 10606 | bool if_condition = var ? VarToBOOL(*var) // Not verified recently: 30% faster than having ExpandArgs() resolve ARG1 even when it's a naked variable. |
| 10607 | : ResultToBOOL(ARG1); // CAN'T simply check *ARG1=='1' because the loadtime routine has various ways of setting if_expresion to false for things that are normally expressions. |
| 10608 | |
| 10609 | return if_condition ? CONDITION_TRUE : CONDITION_FALSE; |
| 10610 | } |
| 10611 | |
| 10612 | |
| 10613 |
no test coverage detected