Skip to content

Commit c6438df

Browse files
committed
Emitter (C): always emit 2-arg decode-fn form (matches uniform runtime sigs)
1 parent 9ae7aa8 commit c6438df

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

codegen/src/emit-c.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,13 +372,14 @@ function renderCArg(v: unknown): string {
372372
}
373373

374374
function renderDecodeCall(call: DecodeCall, valueExpr: string): string {
375+
// Always emit 2-arg form. Runtime helpers and hatches all accept
376+
// (value, args_json) uniformly; args_json is "{}" when no args.
377+
// Matches the Rust emitter's convergence-pass behavior.
378+
const argsJson = cString(JSON.stringify(call.args));
375379
if (call.fn === "custom") {
376-
return `ads_hatch_${call.name}(${valueExpr}, ${cString(JSON.stringify(call.args))})`;
380+
return `ads_hatch_${call.name}(${valueExpr}, ${argsJson})`;
377381
}
378-
if (Object.keys(call.args).length > 0) {
379-
return `ads_decode_${call.fn}(${valueExpr}, ${cString(JSON.stringify(call.args))})`;
380-
}
381-
return `ads_decode_${call.fn}(${valueExpr})`;
382+
return `ads_decode_${call.fn}(${valueExpr}, ${argsJson})`;
382383
}
383384

384385
function renderExpr(expr: ValueExpr): string {

0 commit comments

Comments
 (0)