Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl.y:
$$.else_block = list_to_block($3); }
+loop_iterator:
expr_optional
{
struct hlsl_scope *scope = ctx->cur_scope;
if ($1)
{
list_move_tail(&scope->loop_iterator.instrs, $1);
}
}
After seeing it in action, this really doesn't feel like the simplest solution, compared to some of the others that have been proposed.