Commit c8a28a96 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added support for VT_INT.

parent c61af66c
......@@ -342,8 +342,10 @@ static HRESULT convert_params(const DISPPARAMS *dp, VARIANT *buf, DISPPARAMS *re
*ret = *dp;
for(i = 0; i < ret->cArgs; i++) {
if(V_VT(get_arg(dp, i)) == VT_I2) {
for(i = 0; i < ret->cArgs && !need_conversion; i++) {
switch(V_VT(get_arg(dp, i))) {
case VT_I2:
case VT_INT:
need_conversion = TRUE;
break;
}
......@@ -368,6 +370,10 @@ static HRESULT convert_params(const DISPPARAMS *dp, VARIANT *buf, DISPPARAMS *re
V_VT(d) = VT_I4;
V_I4(d) = V_I2(s);
break;
case VT_INT:
V_VT(d) = VT_I4;
V_I4(d) = V_INT(s);
break;
default:
*d = *s;
}
......@@ -1015,6 +1021,10 @@ static void ensure_retval_type(VARIANT *v)
case VT_I2:
V_VT(v) = VT_I4;
V_I4(v) = V_I2(v);
break;
case VT_INT:
V_VT(v) = VT_I4;
V_I4(v) = V_INT(v);
}
}
......
......@@ -263,6 +263,7 @@ HRESULT to_primitive(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, VARIANT *ret
return throw_type_error(ctx, ei, JS_E_TO_PRIMITIVE, NULL);
}
case VT_I2:
case VT_INT:
assert(0);
default:
FIXME("Unimplemented for vt %d\n", V_VT(v));
......@@ -447,6 +448,7 @@ HRESULT to_number(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, double *ret)
*ret = V_BOOL(v) ? 1 : 0;
break;
case VT_I2:
case VT_INT:
assert(0);
default:
FIXME("unimplemented for vt %d\n", V_VT(v));
......
......@@ -97,12 +97,14 @@ DEFINE_EXPECT(DeleteMemberByDispID);
#define DISPID_GLOBAL_OBJECT_FLAG 0x100e
#define DISPID_GLOBAL_ISWIN64 0x100f
#define DISPID_GLOBAL_PUREDISP 0x1010
#define DISPID_GLOBAL_TESTPROPDELETE 0x1010
#define DISPID_GLOBAL_ISNULLBSTR 0x1011
#define DISPID_GLOBAL_PROPARGPUT 0x1012
#define DISPID_GLOBAL_SHORTPROP 0x1013
#define DISPID_GLOBAL_GETSHORT 0x1014
#define DISPID_GLOBAL_TESTARGTYPES 0x1015
#define DISPID_GLOBAL_INTPROP 0x1016
#define DISPID_GLOBAL_TESTPROPDELETE 0x2000
#define DISPID_TESTOBJ_PROP 0x2000
#define DISPID_TESTOBJ_ONLYDISPID 0x2001
......@@ -538,6 +540,11 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
return S_OK;
}
if(!strcmp_wa(bstrName, "intProp")) {
*pid = DISPID_GLOBAL_INTPROP;
return S_OK;
}
if(strict_dispid_check && strcmp_wa(bstrName, "t"))
ok(0, "unexpected call %s\n", wine_dbgstr_w(bstrName));
return DISP_E_UNKNOWNNAME;
......@@ -928,16 +935,21 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
V_I2(pvarRes) = 10;
return S_OK;
case DISPID_GLOBAL_INTPROP:
V_VT(pvarRes) = VT_INT;
V_INT(pvarRes) = 22;
return S_OK;
case DISPID_GLOBAL_TESTARGTYPES: {
VARIANT args[1];
DISPPARAMS dp = {args, NULL, 1, 0};
VARIANT args[2];
DISPPARAMS dp = {args, NULL, sizeof(args)/sizeof(*args), 0};
HRESULT hres;
CHECK_EXPECT(global_testargtypes_i);
ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags);
ok(pdp != NULL, "pdp == NULL\n");
ok(pdp->rgvarg != NULL, "rgvarg != NULL\n");
ok(pdp->cArgs == 3, "cArgs = %d\n", pdp->cArgs);
ok(pdp->cArgs == 5, "cArgs = %d\n", pdp->cArgs);
ok(!pvarRes, "pvarRes != NULL\n");
ok(V_VT(pdp->rgvarg+1) == VT_I4, "V_VT(psp->rgvargs+1) = %d\n", V_VT(pdp->rgvarg));
......@@ -946,10 +958,18 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
ok(V_VT(pdp->rgvarg+2) == VT_I4, "V_VT(psp->rgvargs+2) = %d\n", V_VT(pdp->rgvarg+1));
ok(V_I4(pdp->rgvarg+2) == 10, "V_I4(psp->rgvargs+2) = %d\n", V_I4(pdp->rgvarg+1));
ok(V_VT(pdp->rgvarg+3) == VT_I4, "V_VT(psp->rgvargs+3) = %d\n", V_VT(pdp->rgvarg+3));
ok(V_I4(pdp->rgvarg+3) == 22, "V_I4(psp->rgvargs+3) = %d\n", V_I4(pdp->rgvarg+3));
ok(V_VT(pdp->rgvarg+4) == VT_I4, "V_VT(psp->rgvargs+4) = %d\n", V_VT(pdp->rgvarg+4));
ok(V_I4(pdp->rgvarg+4) == 22, "V_I4(psp->rgvargs+4) = %d\n", V_I4(pdp->rgvarg+4));
ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(psp->rgvargs) = %d\n", V_VT(pdp->rgvarg));
V_VT(args) = VT_I2;
V_I2(args) = 2;
V_VT(args+1) = VT_INT;
V_INT(args+1) = 22;
hres = IDispatch_Invoke(V_DISPATCH(pdp->rgvarg), DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dp, NULL, NULL, NULL);
ok(hres == S_OK, "Invoke failed: %08x\n", hres);
......@@ -1712,7 +1732,10 @@ static BOOL run_tests(void)
CHECK_CALLED(global_propargput_i);
SET_EXPECT(global_testargtypes_i);
parse_script_a("testArgTypes(getShort(), shortProp, function(s) {ok(getVT(s) === 'VT_I4', 'not VT_I4');});");
parse_script_a("testArgTypes(intProp(), intProp, getShort(), shortProp, function(i,s) {"
" ok(getVT(i) === 'VT_I4', 'getVT(i) = ' + getVT(i));"
" ok(getVT(s) === 'VT_I4', 'getVT(s) = ' + getVT(s));"
"});");
CHECK_CALLED(global_testargtypes_i);
run_from_res("lang.js");
......
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