vbscript: Lookup visible items before global members in lookup_identifier.

This commit is contained in:
Jacek Caban 2012-03-26 11:52:33 +02:00 committed by Alexandre Julliard
parent c18b84cf4e
commit e4bfd4e057
2 changed files with 18 additions and 10 deletions

View File

@ -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;
}

View File

@ -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");