vxx / vlib / v / gen / wasm / tests / callback_only.vv
11 lines · 10 sloc · 394 bytes · 863a2090f8eda7dc75e061b26e0bca252f167e24
Raw
1// This module declares an indirect call (`f(x)` in `apply`) but never takes a
2// concrete function as a value, so `fn_value_indices` stays empty. The indirect
3// function table must still be emitted, otherwise the `call_indirect` references
4// a table that does not exist and the module fails to validate.
5pub fn apply(f fn (int) int, x int) int {
6 return f(x)
7}
8
9fn main() {
10 println('ok')
11}
12