reflect casting changes to call-cast style

This commit is contained in:
Ryan Fleury
2025-07-25 15:19:35 -07:00
parent 1c2855a314
commit 393c291f63
+6 -4
View File
@@ -1404,12 +1404,14 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
e_msg_list_concat_in_place(&result.msgs, &casted_tree.msgs);
E_TypeKey cast_type = lhs_irtree.type_key;
E_TypeKind cast_type_kind = e_type_kind_from_key(cast_type);
E_TypeKey cast_type_unwrapped = e_type_key_unwrap(lhs_irtree.type_key, E_TypeUnwrapFlag_AllDecorative);
E_TypeKind cast_type_unwrapped_kind = e_type_kind_from_key(cast_type_unwrapped);
U64 cast_type_byte_size = e_type_byte_size_from_key(cast_type);
E_TypeKey casted_type = casted_tree.type_key;
E_TypeKind casted_type_kind = e_type_kind_from_key(casted_type);
U64 casted_type_byte_size = e_type_byte_size_from_key(casted_type);
U8 in_group = e_type_group_from_kind(casted_type_kind);
U8 out_group = e_type_group_from_kind(cast_type_kind);
U8 out_group = e_type_group_from_kind(cast_type_unwrapped_kind);
RDI_EvalConversionKind conversion_rule = rdi_eval_conversion_kind_from_typegroups(in_group, out_group);
// rjf: bad conditions? -> error if applicable, exit
@@ -1433,7 +1435,7 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
break;
}
// rjf: generate casted result
// rjf: generate
{
E_IRNode *in_tree = e_irtree_resolve_to_value(arena, casted_tree.mode, casted_tree.root, casted_type);
E_IRNode *new_tree = in_tree;
@@ -1441,11 +1443,11 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
{
new_tree = e_irtree_convert_lo(arena, in_tree, out_group, in_group);
}
if(cast_type_byte_size < casted_type_byte_size && e_type_kind_is_integer(cast_type_kind))
if(cast_type_byte_size < casted_type_byte_size && e_type_kind_is_integer(cast_type_unwrapped_kind))
{
new_tree = e_irtree_trunc(arena, in_tree, cast_type);
}
if(e_type_kind_is_signed(cast_type_kind) && e_type_kind_is_integer(casted_type_kind) && !e_type_kind_is_signed(casted_type_kind))
if(e_type_kind_is_signed(cast_type_unwrapped_kind) && e_type_kind_is_integer(casted_type_kind) && !e_type_kind_is_signed(casted_type_kind))
{
new_tree = e_irtree_trunc(arena, in_tree, cast_type);
}