Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/hlsl.c:
+ bool saved_is_internal = ctx->is_internal_function; + void *saved_scanner = ctx->scanner; + int ret; + + TRACE("name %s, func %s.\n", debugstr_a(name), debugstr_a(func)); + + /* Save and restore everything that matters. + * Note that saving the scope stack is hard, and shouldn't be necessary. */ + + ctx->scanner = NULL; + ctx->is_internal_function = true; + ctx->cur_function = NULL; + ret = hlsl_lexer_compile(ctx, &code); + ctx->scanner = saved_scanner; + ctx->is_internal_function = saved_is_internal; + ctx->cur_function = saved_cur_function; I can't say I am a fan of hijacking the context in this way, but overall I can live with it.
-- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/310#note_43658