@@ -114,9 +114,9 @@ impl Eq for Table {}
114114
115115impl Default for Table {
116116 fn default ( ) -> Self {
117- use wrt_foundation:: types:: { Limits , TableType , RefType } ;
117+ use wrt_foundation:: types:: { Limits , TableType } ;
118118 let table_type = TableType {
119- element_type : RefType :: Funcref ,
119+ element_type : WrtValueType :: FuncRef ,
120120 limits : Limits { min : 0 , max : Some ( 1 ) } ,
121121 } ;
122122 Self :: new ( table_type) . unwrap ( )
@@ -787,8 +787,13 @@ impl TableOperations for TableManager {
787787 None => {
788788 // Return appropriate null reference based on table element type
789789 match table. ty . element_type {
790- RefType :: Funcref => Ok ( Value :: FuncRef ( None ) ) ,
791- RefType :: Externref => Ok ( Value :: ExternRef ( None ) ) ,
790+ WrtValueType :: FuncRef => Ok ( Value :: FuncRef ( None ) ) ,
791+ WrtValueType :: ExternRef => Ok ( Value :: ExternRef ( None ) ) ,
792+ _ => Err ( Error :: new (
793+ ErrorCategory :: Type ,
794+ codes:: INVALID_TYPE ,
795+ "Table element type is not a reference type" ,
796+ ) ) ,
792797 }
793798 }
794799 }
@@ -956,8 +961,13 @@ impl TableOperations for Table {
956961 None => {
957962 // Return appropriate null reference based on table element type
958963 match self . ty . element_type {
959- RefType :: Funcref => Ok ( Value :: FuncRef ( None ) ) ,
960- RefType :: Externref => Ok ( Value :: ExternRef ( None ) ) ,
964+ WrtValueType :: FuncRef => Ok ( Value :: FuncRef ( None ) ) ,
965+ WrtValueType :: ExternRef => Ok ( Value :: ExternRef ( None ) ) ,
966+ _ => Err ( Error :: new (
967+ ErrorCategory :: Type ,
968+ codes:: INVALID_TYPE ,
969+ "Table element type is not a reference type" ,
970+ ) ) ,
961971 }
962972 }
963973 }
@@ -1105,7 +1115,7 @@ mod tests {
11051115 use super :: * ;
11061116
11071117 fn create_test_table_type ( min : u32 , max : Option < u32 > ) -> TableType {
1108- TableType { element_type : RefType :: Funcref , limits : Limits { min, max } }
1118+ TableType { element_type : ValueType :: FuncRef , limits : Limits { min, max } }
11091119 }
11101120
11111121 #[ test]
@@ -1283,7 +1293,7 @@ mod tests {
12831293 fn test_table_safe_operations ( ) -> Result < ( ) > {
12841294 // Create a table type
12851295 let table_type = TableType {
1286- element_type : RefType :: Funcref ,
1296+ element_type : ValueType :: FuncRef ,
12871297 limits : Limits { min : 5 , max : Some ( 10 ) } ,
12881298 } ;
12891299
0 commit comments