Repository navigation
Commit 38dab2c
[cppia] Fix reported field type for booleans (#1367)
* [cppia] Fix reported field type for booleans
CppiaVar::linkVarTypes has two forms. The static form asks fieldStorageFromType, which
answers fsBool for Bool. The member form switches on exprType instead, and TypeData::link
has already mapped Bool onto etInt by the time it runs, so the field is laid out as fsInt
and reads back through reflection as 1 rather than true.
The member form now asks fieldStorageFromType as well. The slot stays the size of an int,
leaving the layout and the AlignOffset call above it unchanged.
* [cppia] Use sTypeSize for the member offset
Every storage fieldStorageFromType returns maps onto an exprType with the
same size, so the switch collapses to a table lookup and the offsets stay
byte-identical.
* [tests] Check cppia client bool fields
---------
Co-authored-by: Tobiasz Laskowski <tobil4sk@outlook.com>1 parent 2f6ccfa commit 38dab2c
2 files changed
Lines changed: 8 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
193 | 185 | | |
194 | 186 | | |
195 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
| |||
0 commit comments