@@ -12,7 +12,7 @@ use crate::{
12
12
db:: DefDatabase ,
13
13
intern:: Interned ,
14
14
item_tree:: { self , AssocItem , FnFlags , ItemTree , ItemTreeId , ModItem , Param , TreeId } ,
15
- nameres:: { attr_resolution:: ResolvedAttr , DefMap } ,
15
+ nameres:: { attr_resolution:: ResolvedAttr , proc_macro :: ProcMacroKind , DefMap } ,
16
16
type_ref:: { TraitRef , TypeBound , TypeRef } ,
17
17
visibility:: RawVisibility ,
18
18
AssocItemId , AstIdWithPath , ConstId , ConstLoc , FunctionId , FunctionLoc , HasModule , ImplId ,
@@ -348,7 +348,8 @@ impl MacroRulesData {
348
348
#[ derive( Debug , Clone , PartialEq , Eq ) ]
349
349
pub struct ProcMacroData {
350
350
pub name : Name ,
351
- // FIXME: Record deriver helper here?
351
+ /// Derive helpers, if this is a derive
352
+ pub helpers : Option < Box < [ Name ] > > ,
352
353
}
353
354
354
355
impl ProcMacroData {
@@ -360,17 +361,23 @@ impl ProcMacroData {
360
361
let item_tree = loc. id . item_tree ( db) ;
361
362
let makro = & item_tree[ loc. id . value ] ;
362
363
363
- let name = if let Some ( def) = item_tree
364
+ let ( name, helpers ) = if let Some ( def) = item_tree
364
365
. attrs ( db, loc. container . krate ( ) , ModItem :: from ( loc. id . value ) . into ( ) )
365
366
. parse_proc_macro_decl ( & makro. name )
366
367
{
367
- def. name
368
+ (
369
+ def. name ,
370
+ match def. kind {
371
+ ProcMacroKind :: CustomDerive { helpers } => Some ( helpers) ,
372
+ ProcMacroKind :: FnLike | ProcMacroKind :: Attr => None ,
373
+ } ,
374
+ )
368
375
} else {
369
376
// eeeh...
370
377
stdx:: never!( "proc macro declaration is not a proc macro" ) ;
371
- makro. name . clone ( )
378
+ ( makro. name . clone ( ) , None )
372
379
} ;
373
- Arc :: new ( ProcMacroData { name } )
380
+ Arc :: new ( ProcMacroData { name, helpers } )
374
381
}
375
382
}
376
383
0 commit comments