@jacek This implements the consolidation suggested in !11136: global variables and functions now live in a single tree of tagged entries (`scriptdisp_entry_t` - type plus payload) instead of the separate `var_tree`/`func_tree`, so a global name resolves to exactly one member and the identifier path does one lookup instead of two. It also makes re-declaration match native (a Sub/Function re-declares a prior Dim/Sub/Function; Dim keeps an existing name). I left the per-named-item host `DISPID` cache out of this as a separate concern - the payload union can grow a host-property kind later if that's the direction. On the "emit local indexes bound in `exec_global_code`" idea, I'd like to confirm the approach before building it, since the binding has to coexist with the ctx-dependent resolution in `lookup_identifier`: a bare identifier can resolve to a function local, an argument, a runtime `dynamic_var`, a `Me`/class property, a global member, a builtin, or a named item, in that precedence - and the compiler can't statically tell which, so a slot can't be bound purely at compile time. Two directions I can see: 1. Compile-time slots, bound at link only where the name provably can't be shadowed by ctx (not a local/arg of the owning function, not a class property), falling back to the full lookup otherwise. 2. A per-instruction resolution cache filled on first execution and invalidated by a generation counter bumped whenever the global tree changes, sitting after the ctx-dependent checks. Did you have (1) in mind, or something closer to (2)? And how would you want `dynamic_var`/`Me`-property shadowing handled relative to a bound global slot? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11196#note_143613