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

Method CallAsMethod

source/script_object.cpp:829–843  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

827//
828
829ResultType Object::CallAsMethod(ExprTokenType &aFunc, ResultToken &aResultToken, ExprTokenType &aThisToken, ExprTokenType *aParam[], int aParamCount)
830{
831 auto func = TokenToObject(aFunc);
832 if (!func)
833 func = ValueBase(aFunc);
834 ExprTokenType **param = (ExprTokenType **)_malloca((aParamCount + 1) * sizeof(ExprTokenType *));
835 if (!param)
836 _o_throw_oom;
837 param[0] = &aThisToken;
838 memcpy(param + 1, aParam, aParamCount * sizeof(ExprTokenType *));
839 // return %func%(this, aParam*)
840 auto invoke_result = func->Invoke(aResultToken, IT_CALL, nullptr, aFunc, param, aParamCount + 1);
841 _freea(param);
842 return invoke_result;
843}
844
845ResultType Object::CallMeta(LPTSTR aName, ResultToken &aResultToken, ExprTokenType &aThisToken, ExprTokenType *aParam[], int aParamCount)
846{

Callers

nothing calls this directly

Calls 2

TokenToObjectFunction · 0.85
InvokeMethod · 0.45

Tested by

no test coverage detected