[PATCH vkd3d 5/6] vkd3d-shader/hlsl: Factor out a variable_decl rule.

Zebediah Figura zfigura at codeweavers.com
Thu Sep 23 16:47:06 CDT 2021


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 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 941f49cfe..19745e725 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 <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:
-- 
2.33.0




More information about the wine-devel mailing list