Zebediah Figura : vkd3d-shader/hlsl: Factor out add_unary_expr().

Alexandre Julliard julliard at winehq.org
Mon Sep 27 15:20:04 CDT 2021


Module: vkd3d
Branch: master
Commit: 9a627494a3a1612f63e5f876a289904fabe38602
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=9a627494a3a1612f63e5f876a289904fabe38602

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Thu Sep 23 16:47:03 2021 -0500

vkd3d-shader/hlsl: Factor out add_unary_expr().

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d-shader/hlsl.y | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index e9eac55..b8d147a 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -1083,6 +1083,17 @@ static struct list *append_unop(struct list *list, struct hlsl_ir_node *node)
     return list;
 }
 
+static struct list *add_unary_expr(struct hlsl_ctx *ctx, struct list *instrs,
+        enum hlsl_ir_expr_op op, struct vkd3d_shader_location loc)
+{
+    struct hlsl_ir_node *expr;
+
+    if (!(expr = hlsl_new_unary_expr(ctx, op, node_from_list(instrs), loc)))
+        return NULL;
+    list_add_tail(instrs, &expr->entry);
+    return instrs;
+}
+
 static struct list *add_binary_expr(struct hlsl_ctx *ctx, struct list *list1, struct list *list2,
         enum hlsl_ir_expr_op op, struct vkd3d_shader_location loc)
 {
@@ -3033,7 +3044,7 @@ unary_expr:
             if ($1 == UNARY_OP_PLUS)
                 $$ = $2;
             else
-                $$ = append_unop($2, hlsl_new_unary_expr(ctx, ops[$1], node_from_list($2), @1));
+                $$ = add_unary_expr(ctx, $2, ops[$1], @1);
         }
 
     /* var_modifiers is necessary to avoid shift/reduce conflicts. */




More information about the wine-cvs mailing list