Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- libs/vkd3d-shader/hlsl.y | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 42a6768cc..941f49cfe 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1069,12 +1069,6 @@ static struct hlsl_ir_expr *add_expr(struct hlsl_ctx *ctx, struct list *instrs, return expr; }
-static struct list *append_unop(struct list *list, struct hlsl_ir_node *node) -{ - list_add_tail(list, &node->entry); - 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) { @@ -2934,7 +2928,8 @@ postfix_expr: hlsl_error(ctx, @3, VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX, "Invalid swizzle "%s".", $3); YYABORT; } - $$ = append_unop($1, &swizzle->node); + list_add_tail($1, &swizzle->node.entry); + $$ = $1; } else { @@ -3047,6 +3042,7 @@ unary_expr: { struct hlsl_type *src_type = node_from_list($6)->data_type; struct hlsl_type *dst_type; + struct hlsl_ir_expr *cast; unsigned int i;
if ($2) @@ -3074,7 +3070,13 @@ unary_expr: YYABORT; }
- $$ = append_unop($6, &hlsl_new_cast(ctx, node_from_list($6), dst_type, &@3)->node); + if (!(cast = hlsl_new_cast(ctx, node_from_list($6), dst_type, &@3))) + { + hlsl_free_instr_list($6); + YYABORT; + } + list_add_tail($6, &cast->node.entry); + $$ = $6; }
mul_expr: