vbscript: Return the item's disp when it does not have the SCRIPTITEM_CODEONLY flag, rather than the script dispatch.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e52ca3d68b
commit
0202284966
|
@ -1527,7 +1527,9 @@ static HRESULT interp_me(exec_ctx_t *ctx)
|
|||
if(ctx->vbthis)
|
||||
disp = (IDispatch*)&ctx->vbthis->IDispatchEx_iface;
|
||||
else if(ctx->code->named_item)
|
||||
disp = (IDispatch*)&ctx->code->named_item->script_obj->IDispatchEx_iface;
|
||||
disp = (ctx->code->named_item->flags & SCRIPTITEM_CODEONLY)
|
||||
? (IDispatch*)&ctx->code->named_item->script_obj->IDispatchEx_iface
|
||||
: ctx->code->named_item->disp;
|
||||
else if(ctx->script->host_global)
|
||||
disp = ctx->script->host_global;
|
||||
else
|
||||
|
|
|
@ -1858,6 +1858,15 @@ static void test_named_items(void)
|
|||
|
||||
hres = IActiveScript_GetScriptDispatch(script, L"visibleCodeItem", &disp);
|
||||
ok(hres == S_OK, "GetScriptDispatch returned: %08x\n", hres);
|
||||
SET_EXPECT(OnEnterScript);
|
||||
SET_EXPECT(OnLeaveScript);
|
||||
hres = IActiveScriptParse_ParseScriptText(parse, L"me", L"visibleCodeItem", NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &var, NULL);
|
||||
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
||||
ok(V_VT(&var) == VT_DISPATCH && V_DISPATCH(&var) == disp,
|
||||
"Unexpected 'me': V_VT = %d, V_DISPATCH = %p\n", V_VT(&var), V_DISPATCH(&var));
|
||||
VariantClear(&var);
|
||||
CHECK_CALLED(OnEnterScript);
|
||||
CHECK_CALLED(OnLeaveScript);
|
||||
IDispatch_Release(disp);
|
||||
|
||||
SET_EXPECT(GetItemInfo_visible_code);
|
||||
|
@ -1993,6 +2002,15 @@ static void test_named_items(void)
|
|||
CHECK_CALLED(OnLeaveScript);
|
||||
SET_EXPECT(OnEnterScript);
|
||||
SET_EXPECT(OnLeaveScript);
|
||||
hres = IActiveScriptParse_ParseScriptText(parse, L"me", L"globalItem", NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &var, NULL);
|
||||
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
||||
ok(V_VT(&var) == VT_DISPATCH && V_DISPATCH(&var) == &global_named_item,
|
||||
"Unexpected 'me': V_VT = %d, V_DISPATCH = %p\n", V_VT(&var), V_DISPATCH(&var));
|
||||
VariantClear(&var);
|
||||
CHECK_CALLED(OnEnterScript);
|
||||
CHECK_CALLED(OnLeaveScript);
|
||||
SET_EXPECT(OnEnterScript);
|
||||
SET_EXPECT(OnLeaveScript);
|
||||
hres = IActiveScriptParse_ParseScriptText(parse, L"me", L"codeOnlyItem", NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &var, NULL);
|
||||
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
|
||||
ok(V_VT(&var) == VT_DISPATCH && V_DISPATCH(&var) == (IDispatch*)script_disp2,
|
||||
|
|
Loading…
Reference in New Issue