vbscript: Look for the identifier in the named item's disp only if it doesn't have the CODEONLY flag.

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:
Gabriel Ivăncescu 2020-03-30 15:53:37 +03:00 committed by Alexandre Julliard
parent b664ae8e60
commit 9ee723062a
2 changed files with 10 additions and 1 deletions

View File

@ -188,7 +188,9 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
return S_OK; return S_OK;
} }
if(ctx->func->code_ctx->named_item && ctx->func->code_ctx->named_item->disp) { if(ctx->func->code_ctx->named_item && ctx->func->code_ctx->named_item->disp &&
!(ctx->func->code_ctx->named_item->flags & SCRIPTITEM_CODEONLY))
{
hres = disp_get_id(ctx->func->code_ctx->named_item->disp, name, invoke_type, TRUE, &id); hres = disp_get_id(ctx->func->code_ctx->named_item->disp, name, invoke_type, TRUE, &id);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
ref->type = REF_DISP; ref->type = REF_DISP;

View File

@ -2038,6 +2038,13 @@ static void test_named_items(void)
CHECK_CALLED(GetIDsOfNames_visible); CHECK_CALLED(GetIDsOfNames_visible);
CHECK_CALLED(OnLeaveScript); CHECK_CALLED(OnLeaveScript);
SET_EXPECT(OnEnterScript);
SET_EXPECT(OnLeaveScript);
hres = IActiveScriptParse_ParseScriptText(parse, L"dim abc\ntestVar_global = 5\n", L"visibleCodeItem", NULL, NULL, 0, 0, 0, NULL, NULL);
ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres);
CHECK_CALLED(OnEnterScript);
CHECK_CALLED(OnLeaveScript);
SET_EXPECT(OnEnterScript); SET_EXPECT(OnEnterScript);
SET_EXPECT(OnLeaveScript); SET_EXPECT(OnLeaveScript);
hres = IActiveScriptParse_ParseScriptText(parse, L"set global_me = me\n", L"globalItem", NULL, NULL, 0, 0, SCRIPTTEXT_ISPERSISTENT, NULL, NULL); hres = IActiveScriptParse_ParseScriptText(parse, L"set global_me = me\n", L"globalItem", NULL, NULL, 0, 0, SCRIPTTEXT_ISPERSISTENT, NULL, NULL);