diff --git a/tests/test/wasm/twasmfuncref1.pp b/tests/test/wasm/twasmfuncref1.pp new file mode 100644 index 0000000000..8426fbb6c8 --- /dev/null +++ b/tests/test/wasm/twasmfuncref1.pp @@ -0,0 +1,34 @@ +{ %cpu=wasm32 } +{ %norun } + +program twasmfuncref1; + +{$MODE fpc} + +type + TWasmFuncRef = function(a: longint; b: int64): longint; WasmFuncRef; + +procedure testproc; +var + p: TWasmFuncRef; +begin +end; + +procedure testproc2(q: TWasmFuncRef); +begin +end; + +function testproc3: TWasmFuncRef; +begin +end; + +function testproc4(a, b, c: longint; d: TWasmFuncRef; e: int64): TWasmFuncRef; +var + q: TWasmFuncRef; +begin + q := d; + testproc4 := q; +end; + +begin +end. diff --git a/tests/test/wasm/twasmfuncref1a.pp b/tests/test/wasm/twasmfuncref1a.pp new file mode 100644 index 0000000000..cdc25c1c93 --- /dev/null +++ b/tests/test/wasm/twasmfuncref1a.pp @@ -0,0 +1,34 @@ +{ %cpu=wasm32 } +{ %norun } + +program twasmfuncref1; + +{$MODE tp} + +type + TWasmFuncRef = function(a: longint; b: int64): longint; WasmFuncRef; + +procedure testproc; +var + p: TWasmFuncRef; +begin +end; + +procedure testproc2(q: TWasmFuncRef); +begin +end; + +function testproc3: TWasmFuncRef; +begin +end; + +function testproc4(a, b, c: longint; d: TWasmFuncRef; e: int64): TWasmFuncRef; +var + q: TWasmFuncRef; +begin + q := d; + testproc4 := q; +end; + +begin +end.