@@ -54,8 +54,8 @@ pub fn expand_eager_macro(
5454 let expand_to = ExpandTo :: from_call_site ( & macro_call. value ) ;
5555
5656 // Note:
57- // When `lazy_expand` is called, its *parent* file must be already exists .
58- // Here we store an eager macro id for the argument expanded subtree here
57+ // When `lazy_expand` is called, its *parent* file must already exist .
58+ // Here we store an eager macro id for the argument expanded subtree
5959 // for that purpose.
6060 let arg_id = db. intern_macro_call ( MacroCallLoc {
6161 def,
@@ -79,7 +79,11 @@ pub fn expand_eager_macro(
7979 let Some ( value ) = value else {
8080 return Ok ( ExpandResult { value : None , err } )
8181 } ;
82- let subtree = to_subtree ( & value) ;
82+ let subtree = {
83+ let mut subtree = mbe:: syntax_node_to_token_tree ( & value) . 0 ;
84+ subtree. delimiter = crate :: tt:: Delimiter :: unspecified ( ) ;
85+ subtree
86+ } ;
8387
8488 let res = eager. expand ( db, arg_id, & subtree) ;
8589 if err. is_none ( ) {
@@ -100,12 +104,6 @@ pub fn expand_eager_macro(
100104 Ok ( ExpandResult { value : Some ( db. intern_macro_call ( loc) ) , err } )
101105}
102106
103- fn to_subtree ( node : & SyntaxNode ) -> crate :: tt:: Subtree {
104- let mut subtree = mbe:: syntax_node_to_token_tree ( node) . 0 ;
105- subtree. delimiter = crate :: tt:: Delimiter :: unspecified ( ) ;
106- subtree
107- }
108-
109107fn lazy_expand (
110108 db : & dyn ExpandDatabase ,
111109 def : & MacroDefId ,
@@ -121,7 +119,8 @@ fn lazy_expand(
121119 MacroCallKind :: FnLike { ast_id : macro_call. with_value ( ast_id) , expand_to } ,
122120 ) ;
123121
124- db. parse_or_expand_with_err ( id. as_file ( ) ) . map ( |parse| InFile :: new ( id. as_file ( ) , parse) )
122+ let file_id = id. as_file ( ) ;
123+ db. parse_or_expand_with_err ( file_id) . map ( |parse| InFile :: new ( file_id, parse) )
125124}
126125
127126fn eager_macro_recur (
0 commit comments