diff options
| author | gingerBill <bill@gingerbill.org> | 2024-02-22 17:24:42 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-02-22 17:24:42 +0000 |
| commit | 5a84a0822596fac47dd35bf1c2f1d9bb60bbe5c1 (patch) | |
| tree | 5e8f06646054cd3512e7738a5b8059a1bb057156 /src/check_stmt.cpp | |
| parent | a4b8c1ea1779ce93349b203aaf56c5aeca316b61 (diff) | |
Add general support for `bit_field`s
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 10 |
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; } |