@@ -13,15 +13,15 @@ use crate::{
13
13
engine_threading:: * ,
14
14
language:: {
15
15
parsed:: {
16
- AbiDeclaration , ConfigurableDeclaration , ConstantDeclaration , Declaration ,
17
- EnumDeclaration , FunctionDeclaration , ImplSelfOrTrait , StorageDeclaration ,
16
+ AbiDeclaration , ConfigurableDeclaration , ConstGenericDeclaration , ConstantDeclaration ,
17
+ Declaration , EnumDeclaration , FunctionDeclaration , ImplSelfOrTrait , StorageDeclaration ,
18
18
StructDeclaration , TraitDeclaration , TraitFn , TraitTypeDeclaration ,
19
19
TypeAliasDeclaration ,
20
20
} ,
21
21
ty:: {
22
- self , TyAbiDecl , TyConfigurableDecl , TyConstantDecl , TyDeclParsedType , TyEnumDecl ,
23
- TyFunctionDecl , TyImplSelfOrTrait , TyStorageDecl , TyStructDecl , TyTraitDecl , TyTraitFn ,
24
- TyTraitType , TyTypeAliasDecl ,
22
+ self , TyAbiDecl , TyConfigurableDecl , TyConstGenericDecl , TyConstantDecl ,
23
+ TyDeclParsedType , TyEnumDecl , TyFunctionDecl , TyImplSelfOrTrait , TyStorageDecl ,
24
+ TyStructDecl , TyTraitDecl , TyTraitFn , TyTraitType , TyTypeAliasDecl ,
25
25
} ,
26
26
} ,
27
27
} ;
@@ -39,6 +39,7 @@ pub struct DeclEngine {
39
39
abi_slab : ConcurrentSlab < TyAbiDecl > ,
40
40
constant_slab : ConcurrentSlab < TyConstantDecl > ,
41
41
configurable_slab : ConcurrentSlab < TyConfigurableDecl > ,
42
+ const_generics_slab : ConcurrentSlab < TyConstGenericDecl > ,
42
43
enum_slab : ConcurrentSlab < TyEnumDecl > ,
43
44
type_alias_slab : ConcurrentSlab < TyTypeAliasDecl > ,
44
45
@@ -59,6 +60,8 @@ pub struct DeclEngine {
59
60
RwLock < HashMap < DeclId < TyConstantDecl > , ParsedDeclId < ConstantDeclaration > > > ,
60
61
configurable_parsed_decl_id_map :
61
62
RwLock < HashMap < DeclId < TyConfigurableDecl > , ParsedDeclId < ConfigurableDeclaration > > > ,
63
+ const_generics_parsed_decl_id_map :
64
+ RwLock < HashMap < DeclId < TyConstGenericDecl > , ParsedDeclId < ConstGenericDeclaration > > > ,
62
65
enum_parsed_decl_id_map : RwLock < HashMap < DeclId < TyEnumDecl > , ParsedDeclId < EnumDeclaration > > > ,
63
66
type_alias_parsed_decl_id_map :
64
67
RwLock < HashMap < DeclId < TyTypeAliasDecl > , ParsedDeclId < TypeAliasDeclaration > > > ,
@@ -79,6 +82,7 @@ impl Clone for DeclEngine {
79
82
abi_slab : self . abi_slab . clone ( ) ,
80
83
constant_slab : self . constant_slab . clone ( ) ,
81
84
configurable_slab : self . configurable_slab . clone ( ) ,
85
+ const_generics_slab : self . const_generics_slab . clone ( ) ,
82
86
enum_slab : self . enum_slab . clone ( ) ,
83
87
type_alias_slab : self . type_alias_slab . clone ( ) ,
84
88
function_parsed_decl_id_map : RwLock :: new (
@@ -103,6 +107,9 @@ impl Clone for DeclEngine {
103
107
configurable_parsed_decl_id_map : RwLock :: new (
104
108
self . configurable_parsed_decl_id_map . read ( ) . clone ( ) ,
105
109
) ,
110
+ const_generics_parsed_decl_id_map : RwLock :: new (
111
+ self . const_generics_parsed_decl_id_map . read ( ) . clone ( ) ,
112
+ ) ,
106
113
enum_parsed_decl_id_map : RwLock :: new ( self . enum_parsed_decl_id_map . read ( ) . clone ( ) ) ,
107
114
type_alias_parsed_decl_id_map : RwLock :: new (
108
115
self . type_alias_parsed_decl_id_map . read ( ) . clone ( ) ,
@@ -187,6 +194,7 @@ decl_engine_get!(storage_slab, ty::TyStorageDecl);
187
194
decl_engine_get ! ( abi_slab, ty:: TyAbiDecl ) ;
188
195
decl_engine_get ! ( constant_slab, ty:: TyConstantDecl ) ;
189
196
decl_engine_get ! ( configurable_slab, ty:: TyConfigurableDecl ) ;
197
+ decl_engine_get ! ( const_generics_slab, ty:: TyConstGenericDecl ) ;
190
198
decl_engine_get ! ( enum_slab, ty:: TyEnumDecl ) ;
191
199
decl_engine_get ! ( type_alias_slab, ty:: TyTypeAliasDecl ) ;
192
200
@@ -258,6 +266,11 @@ decl_engine_insert!(
258
266
configurable_parsed_decl_id_map,
259
267
ty:: TyConfigurableDecl
260
268
) ;
269
+ decl_engine_insert ! (
270
+ const_generics_slab,
271
+ const_generics_parsed_decl_id_map,
272
+ ty:: TyConstGenericDecl
273
+ ) ;
261
274
decl_engine_insert ! ( enum_slab, enum_parsed_decl_id_map, ty:: TyEnumDecl ) ;
262
275
decl_engine_insert ! (
263
276
type_alias_slab,
@@ -695,6 +708,18 @@ impl DeclEngine {
695
708
self . get ( index)
696
709
}
697
710
711
+ /// Friendly helper method for calling the `get` method from the
712
+ /// implementation of [DeclEngineGet] for [DeclEngine]
713
+ ///
714
+ /// Calling [DeclEngine][get] directly is equivalent to this method, but
715
+ /// this method adds additional syntax that some users may find helpful.
716
+ pub fn get_const_generic < I > ( & self , index : & I ) -> Arc < ty:: TyConstGenericDecl >
717
+ where
718
+ DeclEngine : DeclEngineGet < I , ty:: TyConstGenericDecl > ,
719
+ {
720
+ self . get ( index)
721
+ }
722
+
698
723
/// Friendly helper method for calling the `get` method from the
699
724
/// implementation of [DeclEngineGet] for [DeclEngine]
700
725
///
0 commit comments