[PATCH v4 4/7] vbscript: Implement the SCRIPTITEM_CODEONLY flag.
Gabriel Ivăncescu
gabrielopcode at gmail.com
Tue Feb 11 10:33:08 CST 2020
On 11/02/2020 15:33, Jacek Caban wrote:
> Hi Gabriel,
>
> On 07.02.2020 14:55, Gabriel Ivăncescu wrote:
>> -named_item_t *lookup_named_item(script_ctx_t *ctx, const WCHAR *name,
>> unsigned flags)
>> +named_item_t *lookup_named_item(script_ctx_t *ctx, const WCHAR *name,
>> unsigned flags, unsigned no_disp_flags)
>> {
>> named_item_t *item;
>> HRESULT hres;
>> LIST_FOR_EACH_ENTRY(item, &ctx->named_items, named_item_t, entry) {
>> if((item->flags & flags) == flags && !wcsicmp(item->name,
>> name)) {
>> - if(!item->disp) {
>> + if(!item->disp && !(item->flags & no_disp_flags)) {
>
>
> Can you just always check for SCRIPTITEM_CODEONLY before trying to fetch
> IDispatch instead of introducing an additional argument?
>
>
> Thanks,
>
> Jacek
>
Hi Jacek,
That's what I originally had and it's wrong in some corner cases (see
the tests). Specifically, items with SCRIPTITEM_ISVISIBLE will fetch the
IDispatch in the interpreter, even if they have the SCRIPTITEM_CODEONLY
flag (i.e. they have both).
The SCRIPTITEM_CODEONLY flag stops fetching it only from:
* GetScriptDispatch
* ParseScriptText
* ParseProcedureText
Without the SCRIPTITEM_CODEONLY flag, the IDispatch will be fetched in
the above functions. (you can check this in the tests I wrote, by
removing the flag from the test, it should give exact same test failures
as on Windows)
With the flag, it's not fetched. However, items with
SCRIPTITEM_ISVISIBLE will *still* fetch it in the interpreter, when
they're found in code. This is where my previous attempt was wrong, and
why we need the new argument. In the tests, "visibleCodeItem" should
test this. Unless I am missing something here.
Thanks,
Gabriel
More information about the wine-devel
mailing list