Fix ranges in switch statement for strings

This commit is contained in:
gingerBill
2019-06-21 22:40:11 +01:00
parent b0dd3ac599
commit b891c0feab
3 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ TargetEndianKind target_endians[TargetArch_COUNT] = {
String const ODIN_VERSION = str_lit("0.10.0"); String const ODIN_VERSION = str_lit("0.10.1");
String cross_compile_target = str_lit(""); String cross_compile_target = str_lit("");
String cross_compile_lib_dir = str_lit(""); String cross_compile_lib_dir = str_lit("");
+7
View File
@@ -746,6 +746,13 @@ void check_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) {
if (upper_op == Token_GtEq) { if (upper_op == Token_GtEq) {
add_constant_switch_case(ctx, &seen, rhs); add_constant_switch_case(ctx, &seen, rhs);
} }
if (is_type_string(x.type)) {
// NOTE(bill): Force dependency for strings here
add_package_dependency(ctx, "runtime", "string_le");
add_package_dependency(ctx, "runtime", "string_lt");
}
} else { } else {
Operand y = {}; Operand y = {};
if (is_type_typeid(x.type)) { if (is_type_typeid(x.type)) {