mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-21 13:14:59 -07:00
Fix ranges in switch statement for strings
This commit is contained in:
@@ -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_lib_dir = str_lit("");
|
||||
|
||||
|
||||
@@ -746,6 +746,13 @@ void check_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) {
|
||||
if (upper_op == Token_GtEq) {
|
||||
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 {
|
||||
Operand y = {};
|
||||
if (is_type_typeid(x.type)) {
|
||||
|
||||
+1
-1
@@ -1982,7 +1982,7 @@ Ast *parse_operand(AstFile *f, bool lhs) {
|
||||
|
||||
while (allow_token(f, Token_Hash)) {
|
||||
Token tag = expect_token_after(f, Token_Ident, "#");
|
||||
if (tag.string == "align") {
|
||||
if (tag.string == "align") {
|
||||
if (align) {
|
||||
syntax_error(tag, "Duplicate union tag '#%.*s'", LIT(tag.string));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user