[PATCH v3 05/11] vbscript: Store the necessary function and variable info in the script TypeInfo.

Gabriel Ivăncescu gabrielopcode at gmail.com
Fri Nov 22 09:23:04 CST 2019

On 11/22/19 1:42 PM, Jacek Caban wrote:
> Hi Gabriel,
> On 11/18/19 2:29 PM, Gabriel Ivăncescu wrote:
>> +    UINT num_vars;
>> +    UINT num_funcs;
>> +    UINT *func_ids;
> It would need a test to be sure, but I think that storing function IDs 
> here is not right. The function may change if a new script adds a 
> function of the same same. If it should indeed freeze the current state, 
> then you'd want the old function to be exposed from ITypeInfo. Why not 
> simply store an array of function_t pointers instead?

You're right, I forgot about functions replacing earlier ones, I'll add 
tests for that as well and handle it.

We'll still need to store the function ids though, to obtain the DISPID 
(or store the DISPID directly, which simplifies the code). At the moment 
the function ids were enough to obtain the DISPIDs and the functions 
themselves, but since that won't be the case anymore I'll just store both.

> Also, you could just store a reference to each function via something 
> like grab_vbscode(This->functions[i]->code_ctx) instead of introducing 
> vbscode_ref_t.
> Thanks,
> Jacek

The problem is that we'll have to do the same for variables, and those 
don't even hold references to the vbscode and have no such field either, 
which would add more code and make it more complicated, in my opinion. 
That's because the variable name is in the vbscode (we don't copy it to 
the dispatch's heap).

More information about the wine-devel mailing list