◐ Shell
clean mode source ↗

BridgeJS: Use a BigInt zero placeholder for Wasm i64 in generated JS by krodak · Pull Request #757 · swiftwasm/JavaScriptKit

kateinoigakukun

A Wasm i64 parameter or return value is represented as a JavaScript BigInt.
The generated JS used a plain 0 as the placeholder for the absent case of an
optional i64 parameter (isSome ? v : 0) and for the error-path return of an
imported thunk, so calling such an export with null (or an imported i64
function throwing) raised "TypeError: Cannot convert 0 to a BigInt".

Emit 0n for i64 in both placeholders (jsZeroLiteral and the imported-thunk
return placeholder). This was latent because the optional Int64/UInt64
round-trip tests never exercised the none case; add those assertions.

@krodak krodak deleted the kr/optional-scalar-zero-literal branch

June 8, 2026 18:15