[PATCH 02/10] jscript: Store the necessary function and variable info in the TypeInfo.

Jacek Caban jacek at codeweavers.com
Tue Dec 10 11:49:10 CST 2019


Hi Gabriel,

On 12/9/19 6:12 PM, Gabriel Ivăncescu wrote:
>   static DWORD get_flags(jsdisp_t *This, dispex_prop_t *prop)
>   {
>       if(prop->type == PROP_PROTREF) {
> @@ -590,9 +604,21 @@ static HRESULT fill_protrefs(jsdisp_t *This)
>       return S_OK;
>   }
>   
> +struct typeinfo_func {
> +    dispex_prop_t *prop;
> +    jsdisp_t *disp;
> +};


Storing the whole function object reference does not seem right here. 
Maybe we should store function_code_t instead? We could have a single 
getter that could replace both is_source_function() and 
get_source_function_params() from your patches. Such getter should 
probably use function_vtbl_t for that. Storing bytecode_t pointer inside 
function_code_t could also be handy for reference tracking.


>   
> +    for (prop = This->props, end = prop + This->prop_cnt; prop != end; prop++)
> +    {
> +        if (!prop->name || prop->type != PROP_JSVAL || !(prop->flags & PROPF_ENUMERABLE))
> +            continue;
> +
> +        /* If two identifiers differ only by case, the TypeInfo fails */
> +        pos = This->props[get_props_idx(This, prop->hash)].bucket_head;
> +        while (pos)
> +        {
> +            cur = This->props + pos;
> +
> +            if (prop->hash == cur->hash && prop != cur &&
> +                cur->type == PROP_JSVAL && (cur->flags & PROPF_ENUMERABLE) &&
> +                !wcsicmp(prop->name, cur->name))
> +            {
> +                return TYPE_E_AMBIGUOUSNAME;
> +            }
> +            pos = cur->bucket_next;
> +        }


It would be good to limit dispex_prop_t usage inside ITypeInfo in 
general. IDispatchEx support in jscript deserves pretty deep changes and 
extending usage of its internal structure may not be helpful. I'm fine 
with trying to use them here for now, but I'd rather avoid depending on 
its internals and that's the kind of internal thing I'd rather not have 
here. We could call GetDispID(fdexNameCaseInsensitive) and compare 
returned id to current one, if we had support for that. However, is it 
really important in practice? I wouldn't mind leaving it as FIXME for now.


Thanks,

Jacek




More information about the wine-devel mailing list