Fix comparison bug of enumerated arrays

This commit is contained in:
gingerBill
2021-05-27 09:52:50 +01:00
parent 4a886a1bc5
commit bb7bd94b0a

View File

@@ -10918,7 +10918,7 @@ lbValue lb_emit_comp(lbProcedure *p, TokenKind op_kind, lbValue left, lbValue ri
}
}
if (is_type_array(a)) {
if (is_type_array(a) || is_type_enumerated_array(a)) {
Type *tl = base_type(a);
lbValue lhs = lb_address_from_load_or_generate_local(p, left);
lbValue rhs = lb_address_from_load_or_generate_local(p, right);
@@ -10935,7 +10935,11 @@ lbValue lb_emit_comp(lbProcedure *p, TokenKind op_kind, lbValue left, lbValue ri
}
bool inline_array_arith = type_size_of(tl) <= build_context.max_align;
i32 count = cast(i32)tl->Array.count;
i32 count = 0;
switch (tl->kind) {
case Type_Array: count = cast(i32)tl->Array.count; break;
case Type_EnumeratedArray: count = cast(i32)tl->EnumeratedArray.count; break;
}
if (inline_array_arith) {
// inline