@@ -2,7 +2,7 @@ use crate::interpreter::stack::{CallFrame, Stack};
22use crate :: { log, unlikely, Function } ;
33use crate :: { Error , FuncContext , Result , Store } ;
44use alloc:: { boxed:: Box , format, string:: String , string:: ToString , vec, vec:: Vec } ;
5- use tinywasm_types:: { FuncType , ModuleInstanceAddr , ValType , WasmValue } ;
5+ use tinywasm_types:: { ExternRef , FuncRef , FuncType , ModuleInstanceAddr , ValType , WasmValue } ;
66
77#[ derive( Debug ) ]
88/// A function handle
@@ -219,6 +219,18 @@ impl ToValType for f64 {
219219 }
220220}
221221
222+ impl ToValType for FuncRef {
223+ fn to_val_type ( ) -> ValType {
224+ ValType :: RefFunc
225+ }
226+ }
227+
228+ impl ToValType for ExternRef {
229+ fn to_val_type ( ) -> ValType {
230+ ValType :: RefExtern
231+ }
232+ }
233+
222234macro_rules! impl_val_types_from_tuple {
223235 ( $( $t: ident) ,+) => {
224236 impl <$( $t) ,+> ValTypesFromTuple for ( $( $t, ) +)
@@ -251,11 +263,15 @@ impl_from_wasm_value_tuple_single!(i32);
251263impl_from_wasm_value_tuple_single ! ( i64 ) ;
252264impl_from_wasm_value_tuple_single ! ( f32 ) ;
253265impl_from_wasm_value_tuple_single ! ( f64 ) ;
266+ impl_from_wasm_value_tuple_single ! ( FuncRef ) ;
267+ impl_from_wasm_value_tuple_single ! ( ExternRef ) ;
254268
255269impl_into_wasm_value_tuple_single ! ( i32 ) ;
256270impl_into_wasm_value_tuple_single ! ( i64 ) ;
257271impl_into_wasm_value_tuple_single ! ( f32 ) ;
258272impl_into_wasm_value_tuple_single ! ( f64 ) ;
273+ impl_into_wasm_value_tuple_single ! ( FuncRef ) ;
274+ impl_into_wasm_value_tuple_single ! ( ExternRef ) ;
259275
260276impl_val_types_from_tuple ! ( T1 ) ;
261277impl_val_types_from_tuple ! ( T1 , T2 ) ;
0 commit comments