mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Clean up range code for switch
This commit is contained in:
+2
-2
@@ -744,9 +744,9 @@ void check_switch_stmt(Checker *c, AstNode *node, u32 mod_flags) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a1.mode != Addressing_Invalid &&
|
if (a1.mode != Addressing_Invalid && b1.mode != Addressing_Invalid &&
|
||||||
lhs.mode == Addressing_Constant && rhs.mode == Addressing_Constant &&
|
lhs.mode == Addressing_Constant && rhs.mode == Addressing_Constant &&
|
||||||
!is_type_string(lhs.type) && !is_type_string(rhs.type)) {
|
is_type_number(lhs.type) && is_type_number(rhs.type)) {
|
||||||
ExactValue start = lhs.value;
|
ExactValue start = lhs.value;
|
||||||
ExactValue end = rhs.value;
|
ExactValue end = rhs.value;
|
||||||
ExactValue one = exact_value_i64(1);
|
ExactValue one = exact_value_i64(1);
|
||||||
|
|||||||
@@ -666,6 +666,13 @@ bool is_type_rune(Type *t) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
bool is_type_number(Type *t) {
|
||||||
|
t = core_type(t);
|
||||||
|
if (t->kind == Type_Basic) {
|
||||||
|
return (t->Basic.flags & BasicFlag_Numeric) != 0;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
bool is_type_numeric(Type *t) {
|
bool is_type_numeric(Type *t) {
|
||||||
t = core_type(t);
|
t = core_type(t);
|
||||||
if (t->kind == Type_Basic) {
|
if (t->kind == Type_Basic) {
|
||||||
|
|||||||
Reference in New Issue
Block a user