diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 4be1d430810..df30e0e68cc 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -164,16 +164,6 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ } LIST_FOR_EACH_ENTRY(item, &ctx->script->named_items, named_item_t, entry) { - if((item->flags & SCRIPTITEM_GLOBALMEMBERS)) { - hres = disp_get_id(item->disp, name, invoke_type, FALSE, &id); - if(SUCCEEDED(hres)) { - ref->type = REF_DISP; - ref->u.d.disp = item->disp; - ref->u.d.id = id; - return S_OK; - } - } - if((item->flags & SCRIPTITEM_ISVISIBLE) && !strcmpiW(item->name, name)) { if(!item->disp) { IUnknown *unk; @@ -198,6 +188,18 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ } } + LIST_FOR_EACH_ENTRY(item, &ctx->script->named_items, named_item_t, entry) { + if((item->flags & SCRIPTITEM_GLOBALMEMBERS)) { + hres = disp_get_id(item->disp, name, invoke_type, FALSE, &id); + if(SUCCEEDED(hres)) { + ref->type = REF_DISP; + ref->u.d.disp = item->disp; + ref->u.d.id = id; + return S_OK; + } + } + } + ref->type = REF_NONE; return S_OK; } diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index 43c9be4738d..3fb506b1bc4 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -1197,6 +1197,12 @@ static void run_tests(void) CHECK_CALLED(global_success_d); CHECK_CALLED(global_success_i); + SET_EXPECT(global_success_d); + SET_EXPECT(global_success_i); + parse_script_a("test.reportSuccess()"); + CHECK_CALLED(global_success_d); + CHECK_CALLED(global_success_i); + SET_EXPECT(global_vbvar_d); SET_EXPECT(global_vbvar_i); parse_script_a("Option Explicit\nvbvar = 3");