@@ -251,11 +251,6 @@ impl ConstData {
251251 Arc :: new ( ConstData :: new ( db, vis_default, node) )
252252 }
253253
254- pub ( crate ) fn static_data_query ( db : & dyn DefDatabase , konst : StaticId ) -> Arc < ConstData > {
255- let node = konst. lookup ( db) . source ( db) ;
256- Arc :: new ( ConstData :: new ( db, RawVisibility :: private ( ) , node) )
257- }
258-
259254 fn new < N : NameOwner + TypeAscriptionOwner + VisibilityOwner > (
260255 db : & dyn DefDatabase ,
261256 vis_default : RawVisibility ,
@@ -270,6 +265,32 @@ impl ConstData {
270265 }
271266}
272267
268+ #[ derive( Debug , Clone , PartialEq , Eq ) ]
269+ pub struct StaticData {
270+ pub name : Option < Name > ,
271+ pub type_ref : TypeRef ,
272+ pub visibility : RawVisibility ,
273+ pub mutable : bool ,
274+ }
275+
276+ impl StaticData {
277+ pub ( crate ) fn static_data_query ( db : & dyn DefDatabase , konst : StaticId ) -> Arc < StaticData > {
278+ let node = konst. lookup ( db) . source ( db) ;
279+ let ctx = LowerCtx :: new ( db, node. file_id ) ;
280+
281+ let name = node. value . name ( ) . map ( |n| n. as_name ( ) ) ;
282+ let type_ref = TypeRef :: from_ast_opt ( & ctx, node. value . ascribed_type ( ) ) ;
283+ let mutable = node. value . mut_token ( ) . is_some ( ) ;
284+ let visibility = RawVisibility :: from_ast_with_default (
285+ db,
286+ RawVisibility :: private ( ) ,
287+ node. map ( |n| n. visibility ( ) ) ,
288+ ) ;
289+
290+ Arc :: new ( StaticData { name, type_ref, visibility, mutable } )
291+ }
292+ }
293+
273294fn collect_items_in_macros (
274295 db : & dyn DefDatabase ,
275296 expander : & mut Expander ,
0 commit comments