blob: a15c893a96257c0fb49b655e8d6231ee6660f2f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// |jit-test| skip-if: !wasmGcEnabled()
// Functions with anyref in results or params cannot be called
assertErrorMessage(() => wasmEvalText(`(module
(func (export "func") (param anyref))
)`).exports.func(null), TypeError, /cannot pass/);
assertErrorMessage(() => wasmEvalText(`(module
(func (export "func") (result anyref) ref.null any)
)`).exports.func(), TypeError, /cannot pass/);
// Globals of anyref cannot be accessed
let {global} = wasmEvalText(`(module
(global (export "global") (mut anyref) ref.null any)
)`).exports;
assertErrorMessage(() => global.value, TypeError, /cannot pass/);
assertErrorMessage(() => global.value = null, TypeError, /cannot pass/);
// Tables of anyref cannot be accessed
let {table} = wasmEvalText(`(module
(table (export "table") anyref (elem (ref.null any)))
)`).exports;
assertErrorMessage(() => table.get(0), TypeError, /cannot pass/);
assertErrorMessage(() => table.set(0, null), TypeError, /cannot pass/);
|