Commit 0d335089 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Set parameters on function call.

parent dd9f8f7d
......@@ -64,6 +64,30 @@ static IDispatch *get_this(DISPPARAMS *dp)
return NULL;
}
static HRESULT init_parameters(DispatchEx *var_disp, FunctionInstance *function, LCID lcid, DISPPARAMS *dp,
jsexcept_t *ei, IServiceProvider *caller)
{
parameter_t *param;
VARIANT var_empty;
DWORD cargs, i=0;
HRESULT hres;
V_VT(&var_empty) = VT_EMPTY;
cargs = dp->cArgs - dp->cNamedArgs;
for(param = function->parameters; param; param = param->next) {
hres = jsdisp_propput_name(var_disp, param->identifier, lcid,
i < cargs ? dp->rgvarg + dp->cArgs-1 - i : &var_empty,
ei, caller);
if(FAILED(hres))
return hres;
i++;
}
return S_OK;
}
static HRESULT create_var_disp(FunctionInstance *function, LCID lcid, DISPPARAMS *dp, jsexcept_t *ei,
IServiceProvider *caller, DispatchEx **ret)
{
......@@ -74,6 +98,12 @@ static HRESULT create_var_disp(FunctionInstance *function, LCID lcid, DISPPARAMS
if(FAILED(hres))
return hres;
hres = init_parameters(var_disp, function, lcid, dp, ei, caller);
if(FAILED(hres)) {
jsdisp_release(var_disp);
return hres;
}
*ret = var_disp;
return S_OK;
}
......
......@@ -41,6 +41,10 @@ ok(trueVar, "trueVar is not true");
ok(ScriptEngine.length === 0, "ScriptEngine.length is not 0");
function testFunc1(x, y) {
ok(this !== undefined, "this is undefined");
ok(x === true, "x is not 1");
ok(y === "test", "y is not \"test\"");
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment