From 4ce5b5ec36c6cb754ce2f3af8e6c9d1e3e37cf17 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Tue, 19 Nov 2024 17:38:09 +0100 Subject: [PATCH] Add test for most data conversions --- crates/cli/tests/reference/echo.d.ts | 61 ++ crates/cli/tests/reference/echo.js | 1041 ++++++++++++++++++++++++++ crates/cli/tests/reference/echo.rs | 76 ++ crates/cli/tests/reference/echo.wat | 149 ++++ 4 files changed, 1327 insertions(+) create mode 100644 crates/cli/tests/reference/echo.d.ts create mode 100644 crates/cli/tests/reference/echo.js create mode 100644 crates/cli/tests/reference/echo.rs create mode 100644 crates/cli/tests/reference/echo.wat diff --git a/crates/cli/tests/reference/echo.d.ts b/crates/cli/tests/reference/echo.d.ts new file mode 100644 index 00000000000..d5b187aa985 --- /dev/null +++ b/crates/cli/tests/reference/echo.d.ts @@ -0,0 +1,61 @@ +/* tslint:disable */ +/* eslint-disable */ +export function echo_u8(a: number): number; +export function echo_i8(a: number): number; +export function echo_u16(a: number): number; +export function echo_i16(a: number): number; +export function echo_u32(a: number): number; +export function echo_i32(a: number): number; +export function echo_u64(a: bigint): bigint; +export function echo_i64(a: bigint): bigint; +export function echo_u128(a: bigint): bigint; +export function echo_i128(a: bigint): bigint; +export function echo_usize(a: number): number; +export function echo_isize(a: number): number; +export function echo_f32(a: number): number; +export function echo_f64(a: number): number; +export function echo_bool(a: boolean): boolean; +export function echo_char(a: string): string; +export function echo_string(a: string): string; +export function echo_vec_u8(a: Uint8Array): Uint8Array; +export function echo_vec_i8(a: Int8Array): Int8Array; +export function echo_vec_u16(a: Uint16Array): Uint16Array; +export function echo_vec_i16(a: Int16Array): Int16Array; +export function echo_vec_u32(a: Uint32Array): Uint32Array; +export function echo_vec_i32(a: Int32Array): Int32Array; +export function echo_vec_u64(a: BigUint64Array): BigUint64Array; +export function echo_vec_i64(a: BigInt64Array): BigInt64Array; +export function echo_vec_string(a: (string)[]): (string)[]; +export function echo_struct(a: Foo): Foo; +export function echo_vec_struct(a: (Foo)[]): (Foo)[]; +export function echo_option_u8(a?: number): number | undefined; +export function echo_option_i8(a?: number): number | undefined; +export function echo_option_u16(a?: number): number | undefined; +export function echo_option_i16(a?: number): number | undefined; +export function echo_option_u32(a?: number): number | undefined; +export function echo_option_i32(a?: number): number | undefined; +export function echo_option_u64(a?: bigint): bigint | undefined; +export function echo_option_i64(a?: bigint): bigint | undefined; +export function echo_option_u128(a?: bigint): bigint | undefined; +export function echo_option_i128(a?: bigint): bigint | undefined; +export function echo_option_usize(a?: number): number | undefined; +export function echo_option_isize(a?: number): number | undefined; +export function echo_option_f32(a?: number): number | undefined; +export function echo_option_f64(a?: number): number | undefined; +export function echo_option_bool(a?: boolean): boolean | undefined; +export function echo_option_char(a?: string): string | undefined; +export function echo_option_string(a?: string): string | undefined; +export function echo_option_vec_u8(a?: Uint8Array): Uint8Array | undefined; +export function echo_option_vec_i8(a?: Int8Array): Int8Array | undefined; +export function echo_option_vec_u16(a?: Uint16Array): Uint16Array | undefined; +export function echo_option_vec_i16(a?: Int16Array): Int16Array | undefined; +export function echo_option_vec_u32(a?: Uint32Array): Uint32Array | undefined; +export function echo_option_vec_i32(a?: Int32Array): Int32Array | undefined; +export function echo_option_vec_u64(a?: BigUint64Array): BigUint64Array | undefined; +export function echo_option_vec_i64(a?: BigInt64Array): BigInt64Array | undefined; +export function echo_option_vec_string(a?: (string)[]): (string)[] | undefined; +export function echo_option_struct(a?: Foo): Foo | undefined; +export function echo_option_vec_struct(a?: (Foo)[]): (Foo)[] | undefined; +export class Foo { + free(): void; +} diff --git a/crates/cli/tests/reference/echo.js b/crates/cli/tests/reference/echo.js new file mode 100644 index 00000000000..f2eb7da3e3b --- /dev/null +++ b/crates/cli/tests/reference/echo.js @@ -0,0 +1,1041 @@ +let wasm; +export function __wbg_set_wasm(val) { + wasm = val; +} + + +function debugString(val) { + // primitive types + const type = typeof val; + if (type == 'number' || type == 'boolean' || val == null) { + return `${val}`; + } + if (type == 'string') { + return `"${val}"`; + } + if (type == 'symbol') { + const description = val.description; + if (description == null) { + return 'Symbol'; + } else { + return `Symbol(${description})`; + } + } + if (type == 'function') { + const name = val.name; + if (typeof name == 'string' && name.length > 0) { + return `Function(${name})`; + } else { + return 'Function'; + } + } + // objects + if (Array.isArray(val)) { + const length = val.length; + let debug = '['; + if (length > 0) { + debug += debugString(val[0]); + } + for(let i = 1; i < length; i++) { + debug += ', ' + debugString(val[i]); + } + debug += ']'; + return debug; + } + // Test for built-in + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); + let className; + if (builtInMatches && builtInMatches.length > 1) { + className = builtInMatches[1]; + } else { + // Failed to match the standard '[object ClassName]' + return toString.call(val); + } + if (className == 'Object') { + // we're a user defined class or Object + // JSON.stringify avoids problems with cycles, and is generally much + // easier than looping through ownProperties of `val`. + try { + return 'Object(' + JSON.stringify(val) + ')'; + } catch (_) { + return 'Object'; + } + } + // errors + if (val instanceof Error) { + return `${val.name}: ${val.message}\n${val.stack}`; + } + // TODO we could test for more things here, like `Set`s and `Map`s. + return className; +} + +let WASM_VECTOR_LEN = 0; + +let cachedUint8ArrayMemory0 = null; + +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder; + +let cachedTextEncoder = new lTextEncoder('utf-8'); + +const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' + ? function (arg, view) { + return cachedTextEncoder.encodeInto(arg, view); +} + : function (arg, view) { + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; +}); + +function passStringToWasm0(arg, malloc, realloc) { + + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } + + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; + + const mem = getUint8ArrayMemory0(); + + let offset = 0; + + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7F) break; + mem[ptr + offset] = code; + } + + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); + const ret = encodeString(arg, view); + + offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; + } + + WASM_VECTOR_LEN = offset; + return ptr; +} + +let cachedDataViewMemory0 = null; + +function getDataViewMemory0() { + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); + } + return cachedDataViewMemory0; +} + +function isLikeNone(x) { + return x === undefined || x === null; +} + +const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; + +let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + +cachedTextDecoder.decode(); + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} +/** + * @param {number} a + * @returns {number} + */ +export function echo_u8(a) { + const ret = wasm.echo_u8(a); + return ret; +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_i8(a) { + const ret = wasm.echo_i8(a); + return ret; +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_u16(a) { + const ret = wasm.echo_u16(a); + return ret; +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_i16(a) { + const ret = wasm.echo_i16(a); + return ret; +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_u32(a) { + const ret = wasm.echo_u32(a); + return ret >>> 0; +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_i32(a) { + const ret = wasm.echo_i32(a); + return ret; +} + +/** + * @param {bigint} a + * @returns {bigint} + */ +export function echo_u64(a) { + const ret = wasm.echo_u64(a); + return BigInt.asUintN(64, ret); +} + +/** + * @param {bigint} a + * @returns {bigint} + */ +export function echo_i64(a) { + const ret = wasm.echo_i64(a); + return ret; +} + +/** + * @param {bigint} a + * @returns {bigint} + */ +export function echo_u128(a) { + const ret = wasm.echo_u128(a, a >> BigInt(64)); + return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64))); +} + +/** + * @param {bigint} a + * @returns {bigint} + */ +export function echo_i128(a) { + const ret = wasm.echo_i128(a, a >> BigInt(64)); + return (BigInt.asUintN(64, ret[0]) | (ret[1] << BigInt(64))); +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_usize(a) { + const ret = wasm.echo_usize(a); + return ret >>> 0; +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_isize(a) { + const ret = wasm.echo_isize(a); + return ret; +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_f32(a) { + const ret = wasm.echo_f32(a); + return ret; +} + +/** + * @param {number} a + * @returns {number} + */ +export function echo_f64(a) { + const ret = wasm.echo_f64(a); + return ret; +} + +/** + * @param {boolean} a + * @returns {boolean} + */ +export function echo_bool(a) { + const ret = wasm.echo_bool(a); + return ret !== 0; +} + +function _assertChar(c) { + if (typeof(c) === 'number' && (c >= 0x110000 || (c >= 0xD800 && c < 0xE000))) throw new Error(`expected a valid Unicode scalar value, found ${c}`); +} +/** + * @param {string} a + * @returns {string} + */ +export function echo_char(a) { + const char0 = a.codePointAt(0); + _assertChar(char0); + const ret = wasm.echo_char(char0); + return String.fromCodePoint(ret); +} + +/** + * @param {string} a + * @returns {string} + */ +export function echo_string(a) { + let deferred2_0; + let deferred2_1; + try { + const ptr0 = passStringToWasm0(a, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_string(ptr0, len0); + deferred2_0 = ret[0]; + deferred2_1 = ret[1]; + return getStringFromWasm0(ret[0], ret[1]); + } finally { + wasm.__wbindgen_free(deferred2_0, deferred2_1, 1); + } +} + +function passArray8ToWasm0(arg, malloc) { + const ptr = malloc(arg.length * 1, 1) >>> 0; + getUint8ArrayMemory0().set(arg, ptr / 1); + WASM_VECTOR_LEN = arg.length; + return ptr; +} + +function getArrayU8FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); +} +/** + * @param {Uint8Array} a + * @returns {Uint8Array} + */ +export function echo_vec_u8(a) { + const ptr0 = passArray8ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_u8(ptr0, len0); + var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); + return v2; +} + +let cachedInt8ArrayMemory0 = null; + +function getInt8ArrayMemory0() { + if (cachedInt8ArrayMemory0 === null || cachedInt8ArrayMemory0.byteLength === 0) { + cachedInt8ArrayMemory0 = new Int8Array(wasm.memory.buffer); + } + return cachedInt8ArrayMemory0; +} + +function getArrayI8FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getInt8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); +} +/** + * @param {Int8Array} a + * @returns {Int8Array} + */ +export function echo_vec_i8(a) { + const ptr0 = passArray8ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_i8(ptr0, len0); + var v2 = getArrayI8FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); + return v2; +} + +let cachedUint16ArrayMemory0 = null; + +function getUint16ArrayMemory0() { + if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) { + cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer); + } + return cachedUint16ArrayMemory0; +} + +function passArray16ToWasm0(arg, malloc) { + const ptr = malloc(arg.length * 2, 2) >>> 0; + getUint16ArrayMemory0().set(arg, ptr / 2); + WASM_VECTOR_LEN = arg.length; + return ptr; +} + +function getArrayU16FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len); +} +/** + * @param {Uint16Array} a + * @returns {Uint16Array} + */ +export function echo_vec_u16(a) { + const ptr0 = passArray16ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_u16(ptr0, len0); + var v2 = getArrayU16FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 2, 2); + return v2; +} + +let cachedInt16ArrayMemory0 = null; + +function getInt16ArrayMemory0() { + if (cachedInt16ArrayMemory0 === null || cachedInt16ArrayMemory0.byteLength === 0) { + cachedInt16ArrayMemory0 = new Int16Array(wasm.memory.buffer); + } + return cachedInt16ArrayMemory0; +} + +function getArrayI16FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getInt16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len); +} +/** + * @param {Int16Array} a + * @returns {Int16Array} + */ +export function echo_vec_i16(a) { + const ptr0 = passArray16ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_i16(ptr0, len0); + var v2 = getArrayI16FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 2, 2); + return v2; +} + +let cachedUint32ArrayMemory0 = null; + +function getUint32ArrayMemory0() { + if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) { + cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer); + } + return cachedUint32ArrayMemory0; +} + +function passArray32ToWasm0(arg, malloc) { + const ptr = malloc(arg.length * 4, 4) >>> 0; + getUint32ArrayMemory0().set(arg, ptr / 4); + WASM_VECTOR_LEN = arg.length; + return ptr; +} + +function getArrayU32FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len); +} +/** + * @param {Uint32Array} a + * @returns {Uint32Array} + */ +export function echo_vec_u32(a) { + const ptr0 = passArray32ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_u32(ptr0, len0); + var v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + return v2; +} + +let cachedInt32ArrayMemory0 = null; + +function getInt32ArrayMemory0() { + if (cachedInt32ArrayMemory0 === null || cachedInt32ArrayMemory0.byteLength === 0) { + cachedInt32ArrayMemory0 = new Int32Array(wasm.memory.buffer); + } + return cachedInt32ArrayMemory0; +} + +function getArrayI32FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getInt32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len); +} +/** + * @param {Int32Array} a + * @returns {Int32Array} + */ +export function echo_vec_i32(a) { + const ptr0 = passArray32ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_i32(ptr0, len0); + var v2 = getArrayI32FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + return v2; +} + +let cachedBigUint64ArrayMemory0 = null; + +function getBigUint64ArrayMemory0() { + if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) { + cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer); + } + return cachedBigUint64ArrayMemory0; +} + +function passArray64ToWasm0(arg, malloc) { + const ptr = malloc(arg.length * 8, 8) >>> 0; + getBigUint64ArrayMemory0().set(arg, ptr / 8); + WASM_VECTOR_LEN = arg.length; + return ptr; +} + +function getArrayU64FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len); +} +/** + * @param {BigUint64Array} a + * @returns {BigUint64Array} + */ +export function echo_vec_u64(a) { + const ptr0 = passArray64ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_u64(ptr0, len0); + var v2 = getArrayU64FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); + return v2; +} + +let cachedBigInt64ArrayMemory0 = null; + +function getBigInt64ArrayMemory0() { + if (cachedBigInt64ArrayMemory0 === null || cachedBigInt64ArrayMemory0.byteLength === 0) { + cachedBigInt64ArrayMemory0 = new BigInt64Array(wasm.memory.buffer); + } + return cachedBigInt64ArrayMemory0; +} + +function getArrayI64FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getBigInt64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len); +} +/** + * @param {BigInt64Array} a + * @returns {BigInt64Array} + */ +export function echo_vec_i64(a) { + const ptr0 = passArray64ToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_i64(ptr0, len0); + var v2 = getArrayI64FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); + return v2; +} + +function addToExternrefTable0(obj) { + const idx = wasm.__externref_table_alloc(); + wasm.__wbindgen_export_2.set(idx, obj); + return idx; +} + +function passArrayJsValueToWasm0(array, malloc) { + const ptr = malloc(array.length * 4, 4) >>> 0; + const mem = getDataViewMemory0(); + for (let i = 0; i < array.length; i++) { + mem.setUint32(ptr + 4 * i, addToExternrefTable0(array[i]), true); + } + WASM_VECTOR_LEN = array.length; + return ptr; +} + +function getArrayJsValueFromWasm0(ptr, len) { + ptr = ptr >>> 0; + const mem = getDataViewMemory0(); + const result = []; + for (let i = ptr; i < ptr + 4 * len; i += 4) { + result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true))); + } + wasm.__externref_drop_slice(ptr, len); + return result; +} +/** + * @param {(string)[]} a + * @returns {(string)[]} + */ +export function echo_vec_string(a) { + const ptr0 = passArrayJsValueToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_string(ptr0, len0); + var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + return v2; +} + +function _assertClass(instance, klass) { + if (!(instance instanceof klass)) { + throw new Error(`expected instance of ${klass.name}`); + } +} +/** + * @param {Foo} a + * @returns {Foo} + */ +export function echo_struct(a) { + _assertClass(a, Foo); + var ptr0 = a.__destroy_into_raw(); + const ret = wasm.echo_struct(ptr0); + return Foo.__wrap(ret); +} + +/** + * @param {(Foo)[]} a + * @returns {(Foo)[]} + */ +export function echo_vec_struct(a) { + const ptr0 = passArrayJsValueToWasm0(a, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_vec_struct(ptr0, len0); + var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + return v2; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_u8(a) { + const ret = wasm.echo_option_u8(isLikeNone(a) ? 0xFFFFFF : a); + return ret === 0xFFFFFF ? undefined : ret; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_i8(a) { + const ret = wasm.echo_option_i8(isLikeNone(a) ? 0xFFFFFF : a); + return ret === 0xFFFFFF ? undefined : ret; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_u16(a) { + const ret = wasm.echo_option_u16(isLikeNone(a) ? 0xFFFFFF : a); + return ret === 0xFFFFFF ? undefined : ret; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_i16(a) { + const ret = wasm.echo_option_i16(isLikeNone(a) ? 0xFFFFFF : a); + return ret === 0xFFFFFF ? undefined : ret; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_u32(a) { + const ret = wasm.echo_option_u32(isLikeNone(a) ? 0x100000001 : (a) >>> 0); + return ret === 0x100000001 ? undefined : ret; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_i32(a) { + const ret = wasm.echo_option_i32(isLikeNone(a) ? 0x100000001 : (a) >> 0); + return ret === 0x100000001 ? undefined : ret; +} + +/** + * @param {bigint | undefined} [a] + * @returns {bigint | undefined} + */ +export function echo_option_u64(a) { + const ret = wasm.echo_option_u64(!isLikeNone(a), isLikeNone(a) ? BigInt(0) : a); + return ret[0] === 0 ? undefined : BigInt.asUintN(64, ret[1]); +} + +/** + * @param {bigint | undefined} [a] + * @returns {bigint | undefined} + */ +export function echo_option_i64(a) { + const ret = wasm.echo_option_i64(!isLikeNone(a), isLikeNone(a) ? BigInt(0) : a); + return ret[0] === 0 ? undefined : ret[1]; +} + +/** + * @param {bigint | undefined} [a] + * @returns {bigint | undefined} + */ +export function echo_option_u128(a) { + const ret = wasm.echo_option_u128(!isLikeNone(a), isLikeNone(a) ? BigInt(0) : a, isLikeNone(a) ? BigInt(0) : a >> BigInt(64)); + return ret[0] === 0 ? undefined : (BigInt.asUintN(64, ret[1]) | (BigInt.asUintN(64, ret[2]) << BigInt(64))); +} + +/** + * @param {bigint | undefined} [a] + * @returns {bigint | undefined} + */ +export function echo_option_i128(a) { + const ret = wasm.echo_option_i128(!isLikeNone(a), isLikeNone(a) ? BigInt(0) : a, isLikeNone(a) ? BigInt(0) : a >> BigInt(64)); + return ret[0] === 0 ? undefined : (BigInt.asUintN(64, ret[1]) | (ret[2] << BigInt(64))); +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_usize(a) { + const ret = wasm.echo_option_usize(isLikeNone(a) ? 0x100000001 : (a) >>> 0); + return ret === 0x100000001 ? undefined : ret; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_isize(a) { + const ret = wasm.echo_option_isize(isLikeNone(a) ? 0x100000001 : (a) >> 0); + return ret === 0x100000001 ? undefined : ret; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_f32(a) { + const ret = wasm.echo_option_f32(isLikeNone(a) ? 0x100000001 : Math.fround(a)); + return ret === 0x100000001 ? undefined : ret; +} + +/** + * @param {number | undefined} [a] + * @returns {number | undefined} + */ +export function echo_option_f64(a) { + const ret = wasm.echo_option_f64(!isLikeNone(a), isLikeNone(a) ? 0 : a); + return ret[0] === 0 ? undefined : ret[1]; +} + +/** + * @param {boolean | undefined} [a] + * @returns {boolean | undefined} + */ +export function echo_option_bool(a) { + const ret = wasm.echo_option_bool(isLikeNone(a) ? 0xFFFFFF : a ? 1 : 0); + return ret === 0xFFFFFF ? undefined : ret !== 0; +} + +/** + * @param {string | undefined} [a] + * @returns {string | undefined} + */ +export function echo_option_char(a) { + const char0 = isLikeNone(a) ? 0xFFFFFF : a.codePointAt(0); + if (char0 !== 0xFFFFFF) { _assertChar(char0); } + const ret = wasm.echo_option_char(char0); + return ret === 0xFFFFFF ? undefined : String.fromCodePoint(ret); +} + +/** + * @param {string | undefined} [a] + * @returns {string | undefined} + */ +export function echo_option_string(a) { + var ptr0 = isLikeNone(a) ? 0 : passStringToWasm0(a, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_string(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getStringFromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); + } + return v2; +} + +/** + * @param {Uint8Array | undefined} [a] + * @returns {Uint8Array | undefined} + */ +export function echo_option_vec_u8(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray8ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_u8(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); + } + return v2; +} + +/** + * @param {Int8Array | undefined} [a] + * @returns {Int8Array | undefined} + */ +export function echo_option_vec_i8(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray8ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_i8(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayI8FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); + } + return v2; +} + +/** + * @param {Uint16Array | undefined} [a] + * @returns {Uint16Array | undefined} + */ +export function echo_option_vec_u16(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray16ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_u16(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayU16FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 2, 2); + } + return v2; +} + +/** + * @param {Int16Array | undefined} [a] + * @returns {Int16Array | undefined} + */ +export function echo_option_vec_i16(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray16ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_i16(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayI16FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 2, 2); + } + return v2; +} + +/** + * @param {Uint32Array | undefined} [a] + * @returns {Uint32Array | undefined} + */ +export function echo_option_vec_u32(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray32ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_u32(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + } + return v2; +} + +/** + * @param {Int32Array | undefined} [a] + * @returns {Int32Array | undefined} + */ +export function echo_option_vec_i32(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray32ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_i32(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayI32FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + } + return v2; +} + +/** + * @param {BigUint64Array | undefined} [a] + * @returns {BigUint64Array | undefined} + */ +export function echo_option_vec_u64(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray64ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_u64(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayU64FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); + } + return v2; +} + +/** + * @param {BigInt64Array | undefined} [a] + * @returns {BigInt64Array | undefined} + */ +export function echo_option_vec_i64(a) { + var ptr0 = isLikeNone(a) ? 0 : passArray64ToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_i64(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayI64FromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 8, 8); + } + return v2; +} + +/** + * @param {(string)[] | undefined} [a] + * @returns {(string)[] | undefined} + */ +export function echo_option_vec_string(a) { + var ptr0 = isLikeNone(a) ? 0 : passArrayJsValueToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_string(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + } + return v2; +} + +/** + * @param {Foo | undefined} [a] + * @returns {Foo | undefined} + */ +export function echo_option_struct(a) { + let ptr0 = 0; + if (!isLikeNone(a)) { + _assertClass(a, Foo); + ptr0 = a.__destroy_into_raw(); + } + const ret = wasm.echo_option_struct(ptr0); + return ret === 0 ? undefined : Foo.__wrap(ret); +} + +/** + * @param {(Foo)[] | undefined} [a] + * @returns {(Foo)[] | undefined} + */ +export function echo_option_vec_struct(a) { + var ptr0 = isLikeNone(a) ? 0 : passArrayJsValueToWasm0(a, wasm.__wbindgen_malloc); + var len0 = WASM_VECTOR_LEN; + const ret = wasm.echo_option_vec_struct(ptr0, len0); + let v2; + if (ret[0] !== 0) { + v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice(); + wasm.__wbindgen_free(ret[0], ret[1] * 4, 4); + } + return v2; +} + +const FooFinalization = (typeof FinalizationRegistry === 'undefined') + ? { register: () => {}, unregister: () => {} } + : new FinalizationRegistry(ptr => wasm.__wbg_foo_free(ptr >>> 0, 1)); + +export class Foo { + + static __wrap(ptr) { + ptr = ptr >>> 0; + const obj = Object.create(Foo.prototype); + obj.__wbg_ptr = ptr; + FooFinalization.register(obj, obj.__wbg_ptr, obj); + return obj; + } + + static __unwrap(jsValue) { + if (!(jsValue instanceof Foo)) { + return 0; + } + return jsValue.__destroy_into_raw(); + } + + __destroy_into_raw() { + const ptr = this.__wbg_ptr; + this.__wbg_ptr = 0; + FooFinalization.unregister(this); + return ptr; + } + + free() { + const ptr = this.__destroy_into_raw(); + wasm.__wbg_foo_free(ptr, 0); + } +} + +export function __wbg_foo_new(arg0) { + const ret = Foo.__wrap(arg0); + return ret; +}; + +export function __wbg_foo_unwrap(arg0) { + const ret = Foo.__unwrap(arg0); + return ret; +}; + +export function __wbindgen_debug_string(arg0, arg1) { + const ret = debugString(arg1); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; + +export function __wbindgen_init_externref_table() { + const table = wasm.__wbindgen_export_2; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; +}; + +export function __wbindgen_string_get(arg0, arg1) { + const obj = arg1; + const ret = typeof(obj) === 'string' ? obj : undefined; + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); +}; + +export function __wbindgen_string_new(arg0, arg1) { + const ret = getStringFromWasm0(arg0, arg1); + return ret; +}; + +export function __wbindgen_throw(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); +}; + diff --git a/crates/cli/tests/reference/echo.rs b/crates/cli/tests/reference/echo.rs new file mode 100644 index 00000000000..bee663ec508 --- /dev/null +++ b/crates/cli/tests/reference/echo.rs @@ -0,0 +1,76 @@ +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub struct Foo { + x: u32, +} + +macro_rules! echo { + ($(($n:ident, $t:ty)),*) => { + $( + #[wasm_bindgen] + pub fn $n(a: $t) -> $t { + a + } + )* + } +} + +echo!( + (echo_u8, u8), + (echo_i8, i8), + (echo_u16, u16), + (echo_i16, i16), + (echo_u32, u32), + (echo_i32, i32), + (echo_u64, u64), + (echo_i64, i64), + (echo_u128, u128), + (echo_i128, i128), + (echo_usize, usize), + (echo_isize, isize), + (echo_f32, f32), + (echo_f64, f64), + (echo_bool, bool), + (echo_char, char), + (echo_string, String), + (echo_vec_u8, Vec), + (echo_vec_i8, Vec), + (echo_vec_u16, Vec), + (echo_vec_i16, Vec), + (echo_vec_u32, Vec), + (echo_vec_i32, Vec), + (echo_vec_u64, Vec), + (echo_vec_i64, Vec), + (echo_vec_string, Vec), + (echo_struct, Foo), + (echo_vec_struct, Vec), + (echo_option_u8, Option), + (echo_option_i8, Option), + (echo_option_u16, Option), + (echo_option_i16, Option), + (echo_option_u32, Option), + (echo_option_i32, Option), + (echo_option_u64, Option), + (echo_option_i64, Option), + (echo_option_u128, Option), + (echo_option_i128, Option), + (echo_option_usize, Option), + (echo_option_isize, Option), + (echo_option_f32, Option), + (echo_option_f64, Option), + (echo_option_bool, Option), + (echo_option_char, Option), + (echo_option_string, Option), + (echo_option_vec_u8, Option>), + (echo_option_vec_i8, Option>), + (echo_option_vec_u16, Option>), + (echo_option_vec_i16, Option>), + (echo_option_vec_u32, Option>), + (echo_option_vec_i32, Option>), + (echo_option_vec_u64, Option>), + (echo_option_vec_i64, Option>), + (echo_option_vec_string, Option>), + (echo_option_struct, Option), + (echo_option_vec_struct, Option>) +); diff --git a/crates/cli/tests/reference/echo.wat b/crates/cli/tests/reference/echo.wat new file mode 100644 index 00000000000..f73b23625f6 --- /dev/null +++ b/crates/cli/tests/reference/echo.wat @@ -0,0 +1,149 @@ +(module $reference_test.wasm + (type (;0;) (func)) + (type (;1;) (func (result i32))) + (type (;2;) (func (param i32) (result i32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32 i32) (result i32))) + (type (;5;) (func (param i32 i32) (result i32 i32))) + (type (;6;) (func (param i32 i32 i32))) + (type (;7;) (func (param i32 i32 i32 i32) (result i32))) + (type (;8;) (func (param i32 i64) (result i32 i64))) + (type (;9;) (func (param i32 i64 i64) (result i32 i64 i64))) + (type (;10;) (func (param i32 f64) (result i32 f64))) + (type (;11;) (func (param i64) (result i64))) + (type (;12;) (func (param i64 i64) (result i64 i64))) + (type (;13;) (func (param f32) (result f32))) + (type (;14;) (func (param f64) (result f64))) + (import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0))) + (func $__wbindgen_realloc (;1;) (type 7) (param i32 i32 i32 i32) (result i32)) + (func $__wbindgen_malloc (;2;) (type 4) (param i32 i32) (result i32)) + (func $__externref_drop_slice (;3;) (type 3) (param i32 i32)) + (func $echo_option_u8 (;4;) (type 2) (param i32) (result i32)) + (func $echo_option_i8 (;5;) (type 2) (param i32) (result i32)) + (func $echo_option_u16 (;6;) (type 2) (param i32) (result i32)) + (func $echo_option_i16 (;7;) (type 2) (param i32) (result i32)) + (func $echo_option_struct (;8;) (type 2) (param i32) (result i32)) + (func $echo_option_u32 (;9;) (type 14) (param f64) (result f64)) + (func $echo_option_i32 (;10;) (type 14) (param f64) (result f64)) + (func $echo_option_usize (;11;) (type 14) (param f64) (result f64)) + (func $echo_option_isize (;12;) (type 14) (param f64) (result f64)) + (func $echo_option_f32 (;13;) (type 14) (param f64) (result f64)) + (func $echo_u8 (;14;) (type 2) (param i32) (result i32)) + (func $echo_i8 (;15;) (type 2) (param i32) (result i32)) + (func $echo_u16 (;16;) (type 2) (param i32) (result i32)) + (func $echo_i16 (;17;) (type 2) (param i32) (result i32)) + (func $echo_u32 (;18;) (type 2) (param i32) (result i32)) + (func $echo_i32 (;19;) (type 2) (param i32) (result i32)) + (func $echo_usize (;20;) (type 2) (param i32) (result i32)) + (func $echo_isize (;21;) (type 2) (param i32) (result i32)) + (func $echo_f32 (;22;) (type 13) (param f32) (result f32)) + (func $echo_bool (;23;) (type 2) (param i32) (result i32)) + (func $echo_char (;24;) (type 2) (param i32) (result i32)) + (func $echo_struct (;25;) (type 2) (param i32) (result i32)) + (func $echo_option_bool (;26;) (type 2) (param i32) (result i32)) + (func $echo_option_char (;27;) (type 2) (param i32) (result i32)) + (func $echo_u64 (;28;) (type 11) (param i64) (result i64)) + (func $echo_i64 (;29;) (type 11) (param i64) (result i64)) + (func $echo_f64 (;30;) (type 14) (param f64) (result f64)) + (func $__wbindgen_free (;31;) (type 6) (param i32 i32 i32)) + (func $__externref_table_alloc (;32;) (type 1) (result i32)) + (func $__wbg_foo_free (;33;) (type 3) (param i32 i32)) + (func $"echo_option_u128 multivalue shim" (;34;) (type 9) (param i32 i64 i64) (result i32 i64 i64)) + (func $"echo_option_i128 multivalue shim" (;35;) (type 9) (param i32 i64 i64) (result i32 i64 i64)) + (func $"echo_u128 multivalue shim" (;36;) (type 12) (param i64 i64) (result i64 i64)) + (func $"echo_i128 multivalue shim" (;37;) (type 12) (param i64 i64) (result i64 i64)) + (func $"echo_string multivalue shim" (;38;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_u8 multivalue shim" (;39;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_i8 multivalue shim" (;40;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_u16 multivalue shim" (;41;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_i16 multivalue shim" (;42;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_u32 multivalue shim" (;43;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_i32 multivalue shim" (;44;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_u64 multivalue shim" (;45;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_i64 multivalue shim" (;46;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_string multivalue shim" (;47;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_vec_struct multivalue shim" (;48;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_u64 multivalue shim" (;49;) (type 8) (param i32 i64) (result i32 i64)) + (func $"echo_option_i64 multivalue shim" (;50;) (type 8) (param i32 i64) (result i32 i64)) + (func $"echo_option_f64 multivalue shim" (;51;) (type 10) (param i32 f64) (result i32 f64)) + (func $"echo_option_string multivalue shim" (;52;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_u8 multivalue shim" (;53;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_i8 multivalue shim" (;54;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_u16 multivalue shim" (;55;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_i16 multivalue shim" (;56;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_u32 multivalue shim" (;57;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_i32 multivalue shim" (;58;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_u64 multivalue shim" (;59;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_i64 multivalue shim" (;60;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_string multivalue shim" (;61;) (type 5) (param i32 i32) (result i32 i32)) + (func $"echo_option_vec_struct multivalue shim" (;62;) (type 5) (param i32 i32) (result i32 i32)) + (table (;0;) 128 externref) + (memory (;0;) 17) + (export "memory" (memory 0)) + (export "__wbg_foo_free" (func $__wbg_foo_free)) + (export "echo_u8" (func $echo_u8)) + (export "echo_i8" (func $echo_i8)) + (export "echo_u16" (func $echo_u16)) + (export "echo_i16" (func $echo_i16)) + (export "echo_u32" (func $echo_u32)) + (export "echo_i32" (func $echo_i32)) + (export "echo_u64" (func $echo_u64)) + (export "echo_i64" (func $echo_i64)) + (export "echo_u128" (func $"echo_u128 multivalue shim")) + (export "echo_i128" (func $"echo_i128 multivalue shim")) + (export "echo_usize" (func $echo_usize)) + (export "echo_isize" (func $echo_isize)) + (export "echo_f32" (func $echo_f32)) + (export "echo_f64" (func $echo_f64)) + (export "echo_bool" (func $echo_bool)) + (export "echo_char" (func $echo_char)) + (export "echo_string" (func $"echo_string multivalue shim")) + (export "echo_vec_u8" (func $"echo_vec_u8 multivalue shim")) + (export "echo_vec_i8" (func $"echo_vec_i8 multivalue shim")) + (export "echo_vec_u16" (func $"echo_vec_u16 multivalue shim")) + (export "echo_vec_i16" (func $"echo_vec_i16 multivalue shim")) + (export "echo_vec_u32" (func $"echo_vec_u32 multivalue shim")) + (export "echo_vec_i32" (func $"echo_vec_i32 multivalue shim")) + (export "echo_vec_u64" (func $"echo_vec_u64 multivalue shim")) + (export "echo_vec_i64" (func $"echo_vec_i64 multivalue shim")) + (export "echo_vec_string" (func $"echo_vec_string multivalue shim")) + (export "echo_struct" (func $echo_struct)) + (export "echo_vec_struct" (func $"echo_vec_struct multivalue shim")) + (export "echo_option_u8" (func $echo_option_u8)) + (export "echo_option_i8" (func $echo_option_i8)) + (export "echo_option_u16" (func $echo_option_u16)) + (export "echo_option_i16" (func $echo_option_i16)) + (export "echo_option_u32" (func $echo_option_u32)) + (export "echo_option_i32" (func $echo_option_i32)) + (export "echo_option_u64" (func $"echo_option_u64 multivalue shim")) + (export "echo_option_i64" (func $"echo_option_i64 multivalue shim")) + (export "echo_option_u128" (func $"echo_option_u128 multivalue shim")) + (export "echo_option_i128" (func $"echo_option_i128 multivalue shim")) + (export "echo_option_usize" (func $echo_option_usize)) + (export "echo_option_isize" (func $echo_option_isize)) + (export "echo_option_f32" (func $echo_option_f32)) + (export "echo_option_f64" (func $"echo_option_f64 multivalue shim")) + (export "echo_option_bool" (func $echo_option_bool)) + (export "echo_option_char" (func $echo_option_char)) + (export "echo_option_string" (func $"echo_option_string multivalue shim")) + (export "echo_option_vec_u8" (func $"echo_option_vec_u8 multivalue shim")) + (export "echo_option_vec_i8" (func $"echo_option_vec_i8 multivalue shim")) + (export "echo_option_vec_u16" (func $"echo_option_vec_u16 multivalue shim")) + (export "echo_option_vec_i16" (func $"echo_option_vec_i16 multivalue shim")) + (export "echo_option_vec_u32" (func $"echo_option_vec_u32 multivalue shim")) + (export "echo_option_vec_i32" (func $"echo_option_vec_i32 multivalue shim")) + (export "echo_option_vec_u64" (func $"echo_option_vec_u64 multivalue shim")) + (export "echo_option_vec_i64" (func $"echo_option_vec_i64 multivalue shim")) + (export "echo_option_vec_string" (func $"echo_option_vec_string multivalue shim")) + (export "echo_option_struct" (func $echo_option_struct)) + (export "echo_option_vec_struct" (func $"echo_option_vec_struct multivalue shim")) + (export "__wbindgen_malloc" (func $__wbindgen_malloc)) + (export "__wbindgen_realloc" (func $__wbindgen_realloc)) + (export "__wbindgen_export_2" (table 0)) + (export "__wbindgen_free" (func $__wbindgen_free)) + (export "__externref_table_alloc" (func $__externref_table_alloc)) + (export "__externref_drop_slice" (func $__externref_drop_slice)) + (export "__wbindgen_start" (func 0)) + (@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext") +) +