[VBSCRIPT] Sync with Wine Staging 3.9. CORE-14656

This commit is contained in:
Amine Khaldi 2018-06-04 03:52:36 +01:00
parent af009ed327
commit bcea8c65d0
5 changed files with 132 additions and 36 deletions

View file

@ -99,6 +99,7 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
{
named_item_t *item;
function_t *func;
IDispatch *disp;
unsigned i;
DISPID id;
HRESULT hres;
@ -153,6 +154,16 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
}
}
if(ctx->func->code_ctx->context) {
hres = disp_get_id(ctx->func->code_ctx->context, name, invoke_type, TRUE, &id);
if(SUCCEEDED(hres)) {
ref->type = REF_DISP;
ref->u.d.disp = ctx->func->code_ctx->context;
ref->u.d.id = id;
return S_OK;
}
}
if(ctx->func->type != FUNC_GLOBAL && lookup_dynamic_vars(ctx->script->global_vars, name, ref))
return S_OK;
@ -178,29 +189,11 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_
return S_OK;
}
LIST_FOR_EACH_ENTRY(item, &ctx->script->named_items, named_item_t, entry) {
if((item->flags & SCRIPTITEM_ISVISIBLE) && !strcmpiW(item->name, name)) {
if(!item->disp) {
IUnknown *unk;
hres = IActiveScriptSite_GetItemInfo(ctx->script->site, item->name, SCRIPTINFO_IUNKNOWN, &unk, NULL);
if(FAILED(hres)) {
WARN("GetItemInfo failed: %08x\n", hres);
continue;
}
hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&item->disp);
IUnknown_Release(unk);
if(FAILED(hres)) {
WARN("object does not implement IDispatch\n");
continue;
}
}
ref->type = REF_OBJ;
ref->u.obj = item->disp;
return S_OK;
}
disp = lookup_named_item(ctx->script, name, SCRIPTITEM_ISVISIBLE);
if(disp) {
ref->type = REF_OBJ;
ref->u.obj = disp;
return S_OK;
}
LIST_FOR_EACH_ENTRY(item, &ctx->script->named_items, named_item_t, entry) {