[PATCH vkd3d 2/6] vkd3d-shader/hlsl: Factor out add_unary_expr().
Zebediah Figura
zfigura at codeweavers.com
Thu Sep 23 16:47:03 CDT 2021
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
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 e9eac555a..b8d147a01 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. */
--
2.33.0
More information about the wine-devel
mailing list