@@ -78,23 +78,17 @@ impl HirFileId {
7878 HirFileIdRepr :: MacroFile ( macro_file) => {
7979 let loc: MacroCallLoc = db. lookup_intern_macro ( macro_file. macro_call_id ) ;
8080
81- // FIXME: Do we support expansion information in builtin macro?
82- let macro_decl = match loc. def {
83- MacroDefId :: DeclarativeMacro ( it) => ( it) ,
84- MacroDefId :: BuiltinMacro ( _) => return None ,
85- } ;
86-
8781 let arg_start = loc. ast_id . to_node ( db) . token_tree ( ) ?. syntax ( ) . text_range ( ) . start ( ) ;
8882 let def_start =
89- macro_decl . ast_id . to_node ( db) . token_tree ( ) ?. syntax ( ) . text_range ( ) . start ( ) ;
83+ loc . def . ast_id . to_node ( db) . token_tree ( ) ?. syntax ( ) . text_range ( ) . start ( ) ;
9084
9185 let macro_def = db. macro_def ( loc. def ) ?;
9286 let shift = macro_def. 0 . shift ( ) ;
9387 let exp_map = db. parse_macro ( macro_file) ?. 1 ;
9488 let macro_arg = db. macro_arg ( macro_file. macro_call_id ) ?;
9589
9690 let arg_start = ( loc. ast_id . file_id , arg_start) ;
97- let def_start = ( macro_decl . ast_id . file_id , def_start) ;
91+ let def_start = ( loc . def . ast_id . file_id , def_start) ;
9892
9993 Some ( ExpansionInfo { arg_start, def_start, macro_arg, macro_def, exp_map, shift } )
10094 }
@@ -128,22 +122,16 @@ impl salsa::InternKey for MacroCallId {
128122}
129123
130124#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
131- pub enum MacroDefId {
132- DeclarativeMacro ( DeclarativeMacro ) ,
133- BuiltinMacro ( BuiltinMacro ) ,
134- }
135-
136- #[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
137- pub struct DeclarativeMacro {
125+ pub struct MacroDefId {
138126 pub krate : CrateId ,
139127 pub ast_id : AstId < ast:: MacroCall > ,
128+ pub kind : MacroDefKind ,
140129}
141130
142131#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
143- pub struct BuiltinMacro {
144- pub krate : CrateId ,
145- pub ast_id : AstId < ast:: MacroCall > ,
146- pub expander : BuiltinExpander ,
132+ pub enum MacroDefKind {
133+ Declarative ,
134+ BuiltIn ( BuiltinExpander ) ,
147135}
148136
149137#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
0 commit comments