vbscript: Add support for parameterized set statements.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-11-01 17:50:37 +01:00 committed by Alexandre Julliard
parent ea1398382c
commit aad0340c8f
2 changed files with 36 additions and 10 deletions

View File

@ -872,23 +872,18 @@ static HRESULT interp_set_ident(exec_ctx_t *ctx)
DISPPARAMS dp;
HRESULT hres;
TRACE("%s\n", debugstr_w(arg));
TRACE("%s %u\n", debugstr_w(arg), arg_cnt);
if(arg_cnt) {
FIXME("arguments not supported\n");
return E_NOTIMPL;
}
hres = stack_assume_disp(ctx, 0, NULL);
hres = stack_assume_disp(ctx, arg_cnt, NULL);
if(FAILED(hres))
return hres;
vbstack_to_dp(ctx, 0, TRUE, &dp);
hres = assign_ident(ctx, ctx->instr->arg1.bstr, DISPATCH_PROPERTYPUTREF, &dp);
vbstack_to_dp(ctx, arg_cnt, TRUE, &dp);
hres = assign_ident(ctx, arg, DISPATCH_PROPERTYPUTREF, &dp);
if(FAILED(hres))
return hres;
stack_popn(ctx, 1);
stack_popn(ctx, arg_cnt + 1);
return S_OK;
}

View File

@ -104,6 +104,8 @@ DEFINE_EXPECT(global_propargput_d);
DEFINE_EXPECT(global_propargput_i);
DEFINE_EXPECT(global_propargput1_d);
DEFINE_EXPECT(global_propargput1_i);
DEFINE_EXPECT(global_propargset_d);
DEFINE_EXPECT(global_propargset_i);
DEFINE_EXPECT(global_testoptionalarg_i);
DEFINE_EXPECT(global_testerrorobject_i);
DEFINE_EXPECT(collectionobj_newenum_i);
@ -140,6 +142,7 @@ DEFINE_EXPECT(OnLeaveScript);
#define DISPID_GLOBAL_GLOBALCALLBACK 1022
#define DISPID_GLOBAL_TESTERROROBJECT 1023
#define DISPID_GLOBAL_THROWWITHDESC 1024
#define DISPID_GLOBAL_PROPARGSET 1025
#define DISPID_TESTOBJ_PROPGET 2000
#define DISPID_TESTOBJ_PROPPUT 2001
@ -1101,6 +1104,7 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
{ L"RefObj", DISPID_GLOBAL_REFOBJ },
{ L"propargput", DISPID_GLOBAL_PROPARGPUT, REF_EXPECT(global_propargput_d) },
{ L"propargput1", DISPID_GLOBAL_PROPARGPUT1, REF_EXPECT(global_propargput1_d) },
{ L"propargset", DISPID_GLOBAL_PROPARGSET, REF_EXPECT(global_propargset_d) },
{ L"counter", DISPID_GLOBAL_COUNTER },
{ L"doubleAsString", DISPID_GLOBAL_DOUBLEASSTRING },
{ L"testArray", DISPID_GLOBAL_TESTARRAY },
@ -1389,6 +1393,27 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
return S_OK;
case DISPID_GLOBAL_PROPARGSET:
CHECK_EXPECT(global_propargset_i);
ok(wFlags == DISPATCH_PROPERTYPUTREF, "wFlags = %x\n", wFlags);
ok(pdp != NULL, "pdp == NULL\n");
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
ok(pdp->rgdispidNamedArgs != NULL, "rgdispidNamedArgs == NULL\n");
ok(pdp->cArgs == 2, "cArgs = %d\n", pdp->cArgs);
ok(pdp->cNamedArgs == 1, "cNamedArgs = %d\n", pdp->cNamedArgs);
ok(pdp->rgdispidNamedArgs[0] == DISPID_PROPERTYPUT, "pdp->rgdispidNamedArgs[0] = %d\n", pdp->rgdispidNamedArgs[0]);
ok(!pvarRes, "pvarRes != NULL\n");
ok(pei != NULL, "pei == NULL\n");
ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(psp->rgvargs) = %d\n", V_VT(pdp->rgvarg));
ok(V_DISPATCH(pdp->rgvarg) == (IDispatch*)&testObj, "V_DISPATCH(psp->rgvargs) = %p\n", V_DISPATCH(pdp->rgvarg));
ok(V_VT(pdp->rgvarg+1) == VT_I2, "V_VT(psp->rgvargs+1) = %d\n", V_VT(pdp->rgvarg+1));
ok(V_I2(pdp->rgvarg+1) == 0, "V_I2(psp->rgvargs+1) = %d\n", V_I2(pdp->rgvarg+1));
return S_OK;
case DISPID_GLOBAL_COUNTER:
ok(pdp != NULL, "pdp == NULL\n");
todo_wine ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
@ -2835,6 +2860,12 @@ static void run_tests(void)
CHECK_CALLED(global_propargput1_d);
CHECK_CALLED(global_propargput1_i);
SET_EXPECT(global_propargset_d);
SET_EXPECT(global_propargset_i);
parse_script_a("set propargset (counter()) = testObj");
CHECK_CALLED(global_propargset_d);
CHECK_CALLED(global_propargset_i);
SET_EXPECT(testobj_propget_d);
SET_EXPECT(testobj_propget_i);
parse_script_a("dim x\nwith testObj\nx=1+.propget\nend with");