wasmKind property

int get wasmKind

The WASM_* discriminant used by the wasm-c-api's wasm_valtype_t.

v128 and anyref have no encoding there; WebAssembly's base value types stop at f64, funcref and externref.

Implementation

int get wasmKind => switch (this) {
  i32 => c.wasm_valkind_enum.WASM_I32.value,
  i64 => c.wasm_valkind_enum.WASM_I64.value,
  f32 => c.wasm_valkind_enum.WASM_F32.value,
  f64 => c.wasm_valkind_enum.WASM_F64.value,
  funcRef => c.wasm_valkind_enum.WASM_FUNCREF.value,
  externRef => c.wasm_valkind_enum.WASM_EXTERNREF.value,
  v128 || anyRef => throw UnsupportedError(
    '$this cannot be expressed as a wasm-c-api value type',
  ),
};