@@ -114,12 +114,12 @@ impl ComponentState {
114
114
check_max ( current. type_count ( ) , 1 , MAX_WASM_TYPES , "types" , offset) ?;
115
115
}
116
116
117
- current. core_types . push ( TypeId {
118
- type_size : ty. type_size ( ) ,
119
- index : types. len ( ) ,
120
- type_index : Some ( current. core_types . len ( ) ) ,
121
- is_core : true ,
122
- } ) ;
117
+ current. core_types . push ( TypeId :: new (
118
+ ty. type_size ( ) ,
119
+ types. len ( ) ,
120
+ Some ( current. core_types . len ( ) ) ,
121
+ true ,
122
+ ) ) ;
123
123
types. push ( ty) ;
124
124
125
125
Ok ( ( ) )
@@ -142,12 +142,8 @@ impl ComponentState {
142
142
exports : module. exports . clone ( ) ,
143
143
} ) ;
144
144
145
- self . core_modules . push ( TypeId {
146
- type_size : ty. type_size ( ) ,
147
- index : types. len ( ) ,
148
- type_index : None ,
149
- is_core : true ,
150
- } ) ;
145
+ self . core_modules
146
+ . push ( TypeId :: new ( ty. type_size ( ) , types. len ( ) , None , true ) ) ;
151
147
152
148
types. push ( ty) ;
153
149
@@ -213,12 +209,12 @@ impl ComponentState {
213
209
check_max ( current. type_count ( ) , 1 , MAX_WASM_TYPES , "types" , offset) ?;
214
210
}
215
211
216
- current. types . push ( TypeId {
217
- type_size : ty. type_size ( ) ,
218
- index : types. len ( ) ,
219
- type_index : Some ( current. types . len ( ) ) ,
220
- is_core : false ,
221
- } ) ;
212
+ current. types . push ( TypeId :: new (
213
+ ty. type_size ( ) ,
214
+ types. len ( ) ,
215
+ Some ( current. types . len ( ) ) ,
216
+ false ,
217
+ ) ) ;
222
218
types. push ( ty) ;
223
219
224
220
Ok ( ( ) )
@@ -387,12 +383,8 @@ impl ComponentState {
387
383
388
384
let lowered_ty = Type :: Func ( info. into_func_type ( ) ) ;
389
385
390
- self . core_funcs . push ( TypeId {
391
- type_size : lowered_ty. type_size ( ) ,
392
- index : types. len ( ) ,
393
- type_index : None ,
394
- is_core : true ,
395
- } ) ;
386
+ self . core_funcs
387
+ . push ( TypeId :: new ( lowered_ty. type_size ( ) , types. len ( ) , None , true ) ) ;
396
388
397
389
types. push ( lowered_ty) ;
398
390
@@ -406,12 +398,8 @@ impl ComponentState {
406
398
exports : mem:: take ( & mut component. exports ) ,
407
399
} ) ;
408
400
409
- self . components . push ( TypeId {
410
- type_size : ty. type_size ( ) ,
411
- index : types. len ( ) ,
412
- type_index : None ,
413
- is_core : false ,
414
- } ) ;
401
+ self . components
402
+ . push ( TypeId :: new ( ty. type_size ( ) , types. len ( ) , None , false ) ) ;
415
403
416
404
types. push ( ty) ;
417
405
}
@@ -1079,12 +1067,7 @@ impl ComponentState {
1079
1067
kind : InstanceTypeKind :: Instantiated ( module_type_id) ,
1080
1068
} ) ;
1081
1069
1082
- let id = TypeId {
1083
- type_size : ty. type_size ( ) ,
1084
- index : types. len ( ) ,
1085
- type_index : None ,
1086
- is_core : true ,
1087
- } ;
1070
+ let id = TypeId :: new ( ty. type_size ( ) , types. len ( ) , None , true ) ;
1088
1071
1089
1072
types. push ( ty) ;
1090
1073
@@ -1223,12 +1206,7 @@ impl ComponentState {
1223
1206
kind : ComponentInstanceTypeKind :: Instantiated ( component_type_id) ,
1224
1207
} ) ;
1225
1208
1226
- let id = TypeId {
1227
- type_size : ty. type_size ( ) ,
1228
- index : types. len ( ) ,
1229
- type_index : None ,
1230
- is_core : false ,
1231
- } ;
1209
+ let id = TypeId :: new ( ty. type_size ( ) , types. len ( ) , None , false ) ;
1232
1210
1233
1211
types. push ( ty) ;
1234
1212
@@ -1330,12 +1308,7 @@ impl ComponentState {
1330
1308
kind : ComponentInstanceTypeKind :: Exports ( inst_exports) ,
1331
1309
} ) ;
1332
1310
1333
- let id = TypeId {
1334
- type_size : ty. type_size ( ) ,
1335
- index : types. len ( ) ,
1336
- type_index : None ,
1337
- is_core : false ,
1338
- } ;
1311
+ let id = TypeId :: new ( ty. type_size ( ) , types. len ( ) , None , false ) ;
1339
1312
1340
1313
types. push ( ty) ;
1341
1314
@@ -1418,12 +1391,7 @@ impl ComponentState {
1418
1391
kind : InstanceTypeKind :: Exports ( inst_exports) ,
1419
1392
} ) ;
1420
1393
1421
- let id = TypeId {
1422
- type_size : ty. type_size ( ) ,
1423
- index : types. len ( ) ,
1424
- type_index : None ,
1425
- is_core : true ,
1426
- } ;
1394
+ let id = TypeId :: new ( ty. type_size ( ) , types. len ( ) , None , true ) ;
1427
1395
1428
1396
types. push ( ty) ;
1429
1397
@@ -1638,12 +1606,12 @@ impl ComponentState {
1638
1606
let current = components. last_mut ( ) . unwrap ( ) ;
1639
1607
check_max ( current. type_count ( ) , 1 , MAX_WASM_TYPES , "types" , offset) ?;
1640
1608
1641
- current. core_types . push ( TypeId {
1642
- type_size : ty. type_size ,
1643
- index : ty. index ,
1644
- type_index : Some ( current. core_types . len ( ) ) ,
1645
- is_core : true ,
1646
- } ) ;
1609
+ current. core_types . push ( TypeId :: new (
1610
+ ty. type_size as usize ,
1611
+ ty. index ,
1612
+ Some ( current. core_types . len ( ) ) ,
1613
+ true ,
1614
+ ) ) ;
1647
1615
1648
1616
Ok ( ( ) )
1649
1617
}
@@ -1655,12 +1623,12 @@ impl ComponentState {
1655
1623
let current = components. last_mut ( ) . unwrap ( ) ;
1656
1624
check_max ( current. type_count ( ) , 1 , MAX_WASM_TYPES , "types" , offset) ?;
1657
1625
1658
- current. types . push ( TypeId {
1659
- type_size : ty. type_size ,
1660
- index : ty. index ,
1661
- type_index : Some ( current. types . len ( ) ) ,
1662
- is_core : false ,
1663
- } ) ;
1626
+ current. types . push ( TypeId :: new (
1627
+ ty. type_size as usize ,
1628
+ ty. index ,
1629
+ Some ( current. types . len ( ) ) ,
1630
+ false ,
1631
+ ) ) ;
1664
1632
1665
1633
Ok ( ( ) )
1666
1634
}
0 commit comments