✓
Passing This code compiles and runs correctly.
Code
// Cross-target effect-branch dispatch: the MINIMAL single-void-effect shape.
//
// Producer `ticker` fires one effect op `! tick` exactly once. The consumer
// dispatches it to a handler that records the hit, then `report` prints the
// accumulated count. The Koru FLOW is target-agnostic; only the proc bodies
// differ (input.kz = |zig, input.kjs = |js). Both targets must produce the
// SAME expected.txt — that's the cross-target contract.
//
// Modeled on 140_012 (dispatch) but stripped to one fire, no binding shadow.
pub event ticker { n: u64 }
! tick u64
pub event onTick { i: u64 }
pub event report {}
ticker(n: 1)
! tick i |> onTick(i)
report()
Actual
hits=1
Expected output
✓ Zig✓ JavaScripthits=1
Emitted JavaScript source
let hits = 0;
const main_module = {
ticker_event: {
handler(input, H) {
const tick = H.tick;
const n = input.n;
for (let i = 0; i < n; i++) {
tick(i);
}
},
},
onTick_event: {
handler(input) {
const i = input.i;
hits = hits + 1;
},
},
report_event: {
handler(input) {
console.log("hits=" + hits);
},
},
flow0() {
const __arg_0 = 1;
{
const n = __arg_0;
for (let i = 0; i < n; i++) {
{
{
hits = hits + 1;
}
}
} }
},
flow1() {
{
console.log("hits=" + hits);
}
},
};
main_module.flow0();
main_module.flow1();
Test Configuration
MUST_RUN