Commit 7be1a1a
committed
fix(codegen): index-read, index-call, and assign on [func] arrays (#1439)
Follow-up to 9fee3f9. The creation-time element type was widened to
void *, but three downstream codegen paths still assumed int64_t:
- NODE_INDEX_EXPR on a TK_ARRAY with func elements fell through to
int64_t, so EZ_ARRAY_GET read the fn pointer as an integer.
- emit_call_expression had no branch for an indexed callee — it emitted
a raw C subscript on an EzArray struct.
- Array index assignment (arr[i] = ()f) also fell through to int64_t,
producing an int-from-pointer conversion.
Detect func elements at each site and emit void *. For the indexed-call
case, wrap the callee in a function-pointer cast derived from the call
site's arg/return types, mirroring how variable fn-pointer calls are
already handled.1 parent 9fee3f9 commit 7be1a1a
1 file changed
Lines changed: 34 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1333 | 1333 | | |
1334 | 1334 | | |
1335 | 1335 | | |
1336 | | - | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
1337 | 1339 | | |
1338 | 1340 | | |
1339 | 1341 | | |
| |||
3830 | 3832 | | |
3831 | 3833 | | |
3832 | 3834 | | |
| 3835 | + | |
| 3836 | + | |
| 3837 | + | |
| 3838 | + | |
| 3839 | + | |
| 3840 | + | |
| 3841 | + | |
| 3842 | + | |
| 3843 | + | |
| 3844 | + | |
| 3845 | + | |
| 3846 | + | |
| 3847 | + | |
| 3848 | + | |
| 3849 | + | |
| 3850 | + | |
| 3851 | + | |
| 3852 | + | |
| 3853 | + | |
| 3854 | + | |
| 3855 | + | |
| 3856 | + | |
| 3857 | + | |
3833 | 3858 | | |
3834 | 3859 | | |
3835 | 3860 | | |
| |||
4251 | 4276 | | |
4252 | 4277 | | |
4253 | 4278 | | |
4254 | | - | |
4255 | | - | |
4256 | | - | |
4257 | | - | |
| 4279 | + | |
| 4280 | + | |
| 4281 | + | |
| 4282 | + | |
| 4283 | + | |
| 4284 | + | |
| 4285 | + | |
| 4286 | + | |
4258 | 4287 | | |
4259 | 4288 | | |
4260 | 4289 | | |
| |||
0 commit comments