vkd3d-shader/hlsl: Concatenate nested initializers.

Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Francisco Casas 2022-03-30 23:38:27 +02:00 committed by Alexandre Julliard
parent bed085cf9a
commit d9dc1a4554

View File

@ -2408,6 +2408,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
%type <function> func_prototype
%type <initializer> complex_initializer
%type <initializer> complex_initializer_list
%type <initializer> func_arguments
%type <initializer> initializer_expr_list
@ -3215,15 +3216,36 @@ complex_initializer:
$$.args[0] = node_from_list($1);
$$.instrs = $1;
}
| '{' initializer_expr_list '}'
| '{' complex_initializer_list '}'
{
$$ = $2;
}
| '{' initializer_expr_list ',' '}'
| '{' complex_initializer_list ',' '}'
{
$$ = $2;
}
complex_initializer_list:
complex_initializer
| complex_initializer_list ',' complex_initializer
{
struct hlsl_ir_node **new_args;
unsigned int i;
$$ = $1;
if (!(new_args = hlsl_realloc(ctx, $$.args, ($$.args_count + $3.args_count) * sizeof(*$$.args))))
{
free_parse_initializer(&$$);
free_parse_initializer(&$3);
YYABORT;
}
$$.args = new_args;
for (i = 0; i < $3.args_count; ++i)
$$.args[$$.args_count++] = $3.args[i];
list_move_tail($$.instrs, $3.instrs);
free_parse_initializer(&$3);
}
initializer_expr:
assignment_expr