static HRESULT Function_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller) { FunctionInstance *function; TRACE("\n"); if(dispex->builtin_info->class != JSCLASS_FUNCTION) { ERR("dispex is not a function\n"); return E_FAIL; } function = (FunctionInstance*)dispex; switch(flags) { case DISPATCH_METHOD: if(function->value_proc) return invoke_value_proc(function, lcid, flags, dp, retv, ei, caller); return invoke_function(function, lcid, dp, retv, ei, caller); case DISPATCH_PROPERTYGET: { HRESULT hres; BSTR str; hres = function_to_string(function, &str); if(FAILED(hres)) return hres; V_VT(retv) = VT_BSTR; V_BSTR(retv) = str; break; } case DISPATCH_CONSTRUCT: if(function->value_proc) return invoke_value_proc(function, lcid, flags, dp, retv, ei, caller); return invoke_constructor(function, lcid, dp, retv, ei, caller); default: FIXME("not implemented flags %x\n", flags); return E_NOTIMPL; } return S_OK; }
HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller) { FunctionInstance *function; TRACE("\n"); if(!is_vclass(jsthis, JSCLASS_FUNCTION)) { ERR("dispex is not a function\n"); return E_FAIL; } function = (FunctionInstance*)jsthis->u.jsdisp; switch(flags) { case DISPATCH_METHOD: if(function->value_proc) return invoke_value_proc(ctx, function, get_this(dp), flags, dp, retv, ei, caller); return invoke_source(ctx, function, get_this(dp), dp, retv, ei, caller); case DISPATCH_PROPERTYGET: { HRESULT hres; BSTR str; hres = function_to_string(function, &str); if(FAILED(hres)) return hres; V_VT(retv) = VT_BSTR; V_BSTR(retv) = str; break; } case DISPATCH_CONSTRUCT: if(function->value_proc) return invoke_value_proc(ctx, function, get_this(dp), flags, dp, retv, ei, caller); return invoke_constructor(ctx, function, dp, retv, ei, caller); default: FIXME("not implemented flags %x\n", flags); return E_NOTIMPL; } return S_OK; }
HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { FunctionInstance *function; TRACE("func %p this %p\n", func_this, jsthis); assert(is_class(func_this, JSCLASS_FUNCTION)); function = (FunctionInstance*)func_this; if(function->value_proc) return invoke_value_proc(function->dispex.ctx, function, jsthis, flags, argc, argv, r); if(flags == DISPATCH_CONSTRUCT) return invoke_constructor(function->dispex.ctx, function, argc, argv, r); assert(flags == DISPATCH_METHOD); return invoke_source(function->dispex.ctx, function, jsthis, argc, argv, r); }