vkd3d-shader/hlsl: Factor out a variable_decl rule.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-09-23 16:47:06 -05:00 committed by Alexandre Julliard
parent 19b21ed005
commit 58c80574d8

View File

@ -1973,6 +1973,7 @@ static struct list *add_constructor(struct hlsl_ctx *ctx, struct hlsl_type *type
%type <type> typedef_type
%type <variable_def> type_spec
%type <variable_def> variable_decl
%type <variable_def> variable_def
%%
@ -2546,7 +2547,7 @@ variables_def:
list_add_tail($$, &$3->entry);
}
variable_def:
variable_decl:
any_identifier arrays colon_attribute
{
$$ = hlsl_alloc(ctx, sizeof(*$$));
@ -2556,15 +2557,13 @@ variable_def:
$$->semantic = $3.semantic;
$$->reg_reservation = $3.reg_reservation;
}
| any_identifier arrays colon_attribute '=' complex_initializer
variable_def:
variable_decl
| variable_decl '=' complex_initializer
{
$$ = hlsl_alloc(ctx, sizeof(*$$));
$$->loc = @1;
$$->name = $1;
$$->arrays = $2;
$$->semantic = $3.semantic;
$$->reg_reservation = $3.reg_reservation;
$$->initializer = $5;
$$ = $1;
$$->initializer = $3;
}
arrays: