aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-06-21 22:40:11 +0100
committergingerBill <bill@gingerbill.org>2019-06-21 22:40:11 +0100
commitb891c0feab785d5afc69f30aa41d42a72f7a48e8 (patch)
tree650cf7376253962e2f046878cf2ab05cc7cc0c24 /src/check_stmt.cpp
parentb0dd3ac599fedfea18a9d574620fb105a1c33f4f (diff)
Fix ranges in switch statement for strings
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 2ad804139..9a62f4beb 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -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)) {