if (cond) exitWith { code } — evaluates code when cond is true, stores the value in tls_exitWithValue, and signals EvalBreak to stop further statement execution in the current scope. Loop handlers (ForDoOp, StringRepeat) catch EvalBreak, clear it, and use tls_exitWithValue as the loop's return value. At top level (no enclosing loop), EvaluateMultiple captures the value when it sees EvalBreak so t
| 881 | // At top level (no enclosing loop), EvaluateMultiple captures the value when |
| 882 | // it sees EvalBreak so the tri runner still receives "FAIL:..." strings. |
| 883 | static GameValue StringExitWith(const GameState* state, GameValuePar oper1, GameValuePar oper2) |
| 884 | { |
| 885 | bool test = oper1; |
| 886 | if (test) |
| 887 | { |
| 888 | GameVarSpace local(state->GetContext()); |
| 889 | state->BeginContext(&local); |
| 890 | RString expression = oper2; |
| 891 | GameValue ret = state->EvaluateMultiple(expression); |
| 892 | state->EndContext(); |
| 893 | tls_exitWithValue = ret; |
| 894 | const_cast<GameState*>(state)->SetError(EvalBreak); |
| 895 | return ret; |
| 896 | } |
| 897 | return NOTHING; |
| 898 | } |
| 899 | |
| 900 | // --- for / from / to / step / do (for-loop variant) ------------------------- |
| 901 |
nothing calls this directly
no test coverage detected