mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Remove now unnecessary checks.
This commit is contained in:
+2
-6
@@ -5472,7 +5472,7 @@ gb_internal Entity *check_selector(CheckerContext *c, Operand *operand, Ast *nod
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (entity == nullptr && selector->kind == Ast_Ident && operand->type != nullptr &&
|
if (entity == nullptr && selector->kind == Ast_Ident && operand->type != nullptr &&
|
||||||
(is_type_array(type_deref(operand->type)) || is_type_simd_vector(type_deref(operand->type)))) {
|
(is_type_array(type_deref(operand->type)))) {
|
||||||
String field_name = selector->Ident.token.string;
|
String field_name = selector->Ident.token.string;
|
||||||
if (1 < field_name.len && field_name.len <= 4) {
|
if (1 < field_name.len && field_name.len <= 4) {
|
||||||
u8 swizzles_xyzw[4] = {'x', 'y', 'z', 'w'};
|
u8 swizzles_xyzw[4] = {'x', 'y', 'z', 'w'};
|
||||||
@@ -5527,7 +5527,7 @@ gb_internal Entity *check_selector(CheckerContext *c, Operand *operand, Ast *nod
|
|||||||
|
|
||||||
Type *original_type = operand->type;
|
Type *original_type = operand->type;
|
||||||
Type *array_type = base_type(type_deref(original_type));
|
Type *array_type = base_type(type_deref(original_type));
|
||||||
GB_ASSERT(array_type->kind == Type_Array || array_type->kind == Type_SimdVector);
|
GB_ASSERT(array_type->kind == Type_Array);
|
||||||
|
|
||||||
i64 array_count = get_array_type_count(array_type);
|
i64 array_count = get_array_type_count(array_type);
|
||||||
|
|
||||||
@@ -5568,10 +5568,6 @@ gb_internal Entity *check_selector(CheckerContext *c, Operand *operand, Ast *nod
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_type->kind == Type_SimdVector) {
|
|
||||||
operand->mode = Addressing_Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
Entity *swizzle_entity = alloc_entity_variable(nullptr, make_token_ident(field_name), operand->type, EntityState_Resolved);
|
Entity *swizzle_entity = alloc_entity_variable(nullptr, make_token_ident(field_name), operand->type, EntityState_Resolved);
|
||||||
add_type_and_value(c, operand->expr, operand->mode, operand->type, operand->value);
|
add_type_and_value(c, operand->expr, operand->mode, operand->type, operand->value);
|
||||||
return swizzle_entity;
|
return swizzle_entity;
|
||||||
|
|||||||
Reference in New Issue
Block a user