aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorblob1807 <12388588+blob1807@users.noreply.github.com>2024-03-01 14:24:51 +1000
committerGitHub <noreply@github.com>2024-03-01 14:24:51 +1000
commitf14babe419bc8c13252cca770a1b244b2e14dd8b (patch)
treedc1c90fb20d0bbb743d94276a00506202e61e095 /src/check_stmt.cpp
parenta95cead8e7dfb747cc5afa58dc8f1a76966d035b (diff)
parent3263e54144a13714b055307ab0d6ab597eacbddb (diff)
Merge branch 'odin-lang:master' into json-better-enum-support
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 6897701d6..a7dd9743b 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -485,7 +485,17 @@ gb_internal Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, O
}
}
+ Entity *lhs_e = entity_of_node(lhs->expr);
+ u8 prev_bit_field_bit_size = ctx->bit_field_bit_size;
+ if (lhs_e && lhs_e->kind == Entity_Variable && lhs_e->Variable.bit_field_bit_size) {
+ // HACK NOTE(bill): This is a bit of a hack, but it will work fine for this use case
+ ctx->bit_field_bit_size = lhs_e->Variable.bit_field_bit_size;
+ }
+
check_assignment(ctx, rhs, assignment_type, str_lit("assignment"));
+
+ ctx->bit_field_bit_size = prev_bit_field_bit_size;
+
if (rhs->mode == Addressing_Invalid) {
return nullptr;
}