b840992a
c_runtime: oneof encode + decode dispatch (ra6 3g)
Encode resolves the active member per oneof group (last-non-nil wins in declaration order via plan->oneofs[].member_indices), skips non-active members, and force-emits the active branch so default values like text="" still carry presence. Decode clears sibling result-table entries after writing any field with oneof_idx >= 0, mirroring codec.lua's oneof_siblings handling — wire last-wins. Sibling-clear runs for both the scalar/string/enum/bytes arm and the sub-message arm. 20 new tests in test/c_runtime_oneof_test.lua cover all three Result branches across both codegen modes: byte-equal vs full.hello reference, round-trip preservation of the active branch and absence of siblings, default-value emission for active branches, and last-wins on both encode (multi-branch input) and decode (multi-occurrence wire bytes). Acceptance per bd-w3u
Eugene Blikh <bigbes@gmail.com> — 2026-05-23 13:18:12 UTC
Commit b840992a2366a08451b6f45b3d18b19643e4af5e —
view raw patch
Parent(s):
fa57c1e4
| File | Status | + | − |
|---|---|---|---|
.beads/interactions.jsonl
|
M | +1 | |
.beads/issues.jsonl
|
M | +1 | -1 |
runtime/pb/c/c_runtime.c
|
M | +49 | -7 |
test/c_runtime_oneof_test.lua
|
A | +134 |