MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / CallEnumerator

Function CallEnumerator

source/script_object.cpp:329–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327}
328
329ResultType 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.

Callers 3

FromEnumerableMethod · 0.85
PerformLoopForMethod · 0.85
WriteEnumItemsMethod · 0.85

Calls 4

TokenToBOOLFunction · 0.85
RuntimeErrorMethod · 0.80
InvokeMethod · 0.45
FreeMethod · 0.45

Tested by

no test coverage detected