@@ -54,8 +54,8 @@ pub fn expand_eager_macro(
54
54
let expand_to = ExpandTo :: from_call_site ( & macro_call. value ) ;
55
55
56
56
// 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
59
59
// for that purpose.
60
60
let arg_id = db. intern_macro_call ( MacroCallLoc {
61
61
def,
@@ -79,7 +79,11 @@ pub fn expand_eager_macro(
79
79
let Some ( value ) = value else {
80
80
return Ok ( ExpandResult { value : None , err } )
81
81
} ;
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
+ } ;
83
87
84
88
let res = eager. expand ( db, arg_id, & subtree) ;
85
89
if err. is_none ( ) {
@@ -100,12 +104,6 @@ pub fn expand_eager_macro(
100
104
Ok ( ExpandResult { value : Some ( db. intern_macro_call ( loc) ) , err } )
101
105
}
102
106
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
-
109
107
fn lazy_expand (
110
108
db : & dyn ExpandDatabase ,
111
109
def : & MacroDefId ,
@@ -121,7 +119,8 @@ fn lazy_expand(
121
119
MacroCallKind :: FnLike { ast_id : macro_call. with_value ( ast_id) , expand_to } ,
122
120
) ;
123
121
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) )
125
124
}
126
125
127
126
fn eager_macro_recur (
0 commit comments