diff --git a/crates/cli/tests/reference/wasm-export-types.d.ts b/crates/cli/tests/reference/wasm-export-types.d.ts index eb562cd6fb0..a5f399db59d 100644 --- a/crates/cli/tests/reference/wasm-export-types.d.ts +++ b/crates/cli/tests/reference/wasm-export-types.d.ts @@ -1,12 +1,14 @@ /* tslint:disable */ /* eslint-disable */ export function example(a: number, b: bigint, c: any, d: string): string; +export function example_128(a: bigint): bigint | undefined; export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export interface InitOutput { readonly memory: WebAssembly.Memory; readonly example: (a: number, b: bigint, c: any, d: number, e: number) => [number, number]; + readonly example_128: (a: bigint, b: bigint) => [number, bigint, bigint]; readonly __wbindgen_export_0: WebAssembly.Table; readonly __wbindgen_malloc: (a: number, b: number) => number; readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; diff --git a/crates/cli/tests/reference/wasm-export-types.js b/crates/cli/tests/reference/wasm-export-types.js index fc6b51ee861..de290e90502 100644 --- a/crates/cli/tests/reference/wasm-export-types.js +++ b/crates/cli/tests/reference/wasm-export-types.js @@ -95,6 +95,15 @@ export function example(a, b, c, d) { } } +/** + * @param {bigint} a + * @returns {bigint | undefined} + */ +export function example_128(a) { + const ret = wasm.example_128(a, a >> BigInt(64)); + return ret[0] === 0 ? undefined : (BigInt.asUintN(64, ret[1]) | (BigInt.asUintN(64, ret[2]) << BigInt(64))); +} + async function __wbg_load(module, imports) { if (typeof Response === 'function' && module instanceof Response) { if (typeof WebAssembly.instantiateStreaming === 'function') { diff --git a/crates/cli/tests/reference/wasm-export-types.rs b/crates/cli/tests/reference/wasm-export-types.rs index 2911442e640..06f89d912e0 100644 --- a/crates/cli/tests/reference/wasm-export-types.rs +++ b/crates/cli/tests/reference/wasm-export-types.rs @@ -10,3 +10,8 @@ use wasm_bindgen::prelude::*; pub fn example(a: u32, b: u64, c: JsValue, d: &str) -> String { todo!() } + +#[wasm_bindgen] +pub fn example_128(a: u128) -> Option { + None +} diff --git a/crates/cli/tests/reference/wasm-export-types.wat b/crates/cli/tests/reference/wasm-export-types.wat index dcb407e93b8..195c25a5723 100644 --- a/crates/cli/tests/reference/wasm-export-types.wat +++ b/crates/cli/tests/reference/wasm-export-types.wat @@ -4,15 +4,18 @@ (type (;2;) (func (param i32 i32 i32))) (type (;3;) (func (param i32 i32 i32 i32) (result i32))) (type (;4;) (func (param i32 i64 externref i32 i32) (result i32 i32))) + (type (;5;) (func (param i64 i64) (result i32 i64 i64))) (import "wbg" "__wbindgen_init_externref_table" (func (;0;) (type 0))) (func $__wbindgen_realloc (;1;) (type 3) (param i32 i32 i32 i32) (result i32)) (func $__wbindgen_malloc (;2;) (type 1) (param i32 i32) (result i32)) (func $__wbindgen_free (;3;) (type 2) (param i32 i32 i32)) (func $"example externref shim multivalue shim" (;4;) (type 4) (param i32 i64 externref i32 i32) (result i32 i32)) + (func $"example_128 multivalue shim" (;5;) (type 5) (param i64 i64) (result i32 i64 i64)) (table (;0;) 128 externref) (memory (;0;) 17) (export "memory" (memory 0)) (export "example" (func $"example externref shim multivalue shim")) + (export "example_128" (func $"example_128 multivalue shim")) (export "__wbindgen_export_0" (table 0)) (export "__wbindgen_malloc" (func $__wbindgen_malloc)) (export "__wbindgen_realloc" (func $__wbindgen_realloc))