| 327 | } |
| 328 | |
| 329 | ResultType CallEnumerator(IObject *aEnumerator, ExprTokenType *aParam[], int aParamCount, bool aDisplayError) |
| 330 | { |
| 331 | FuncResult result_token; |
| 332 | ExprTokenType t_this(aEnumerator); |
| 333 | auto result = aEnumerator->Invoke(result_token, IT_CALL, nullptr, t_this, aParam, aParamCount); |
| 334 | if (result == FAIL || result == EARLY_EXIT || result == INVOKE_NOT_HANDLED) |
| 335 | { |
| 336 | if (result == INVOKE_NOT_HANDLED && aDisplayError) |
| 337 | return g_script.RuntimeError(ERR_NOT_ENUMERABLE, nullptr, FAIL, nullptr, ErrorPrototype::Type); // Object not callable -> wrong type of object. |
| 338 | return result; |
| 339 | } |
| 340 | result = TokenToBOOL(result_token) ? CONDITION_TRUE : CONDITION_FALSE; |
| 341 | result_token.Free(); |
| 342 | return result; |
| 343 | } |
| 344 | |
| 345 | // Calls an Enumerator repeatedly and returns an Array of all first-arg values. |
| 346 | // This is used in conjunction with Array::ToParams to support other objects. |
no test coverage detected