From 58c80574d8f1d1cf3eaba745eb0bf6f34c7c63a8 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 23 Sep 2021 16:47:06 -0500 Subject: [PATCH] vkd3d-shader/hlsl: Factor out a variable_decl rule. Signed-off-by: Zebediah Figura Signed-off-by: Matteo Bruni Signed-off-by: Giovanni Mascellani Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- libs/vkd3d-shader/hlsl.y | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 941f49cf..19745e72 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1973,6 +1973,7 @@ static struct list *add_constructor(struct hlsl_ctx *ctx, struct hlsl_type *type %type typedef_type %type type_spec +%type variable_decl %type 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: