@@ -27,6 +27,14 @@ use crate::mbe::{self, KleeneOp, MetaVarExpr};
27
27
28
28
/// Context needed to perform transcription of metavariable expressions.
29
29
struct TranscrCtx < ' psess , ' itp > {
30
+ psess : & ' psess ParseSess ,
31
+
32
+ /// Map from metavars to matched tokens
33
+ interp : & ' itp FxHashMap < MacroRulesNormalizedIdent , NamedMatch > ,
34
+
35
+ /// Allow marking spans.
36
+ marker : Marker ,
37
+
30
38
/// The stack of things yet to be completely expanded.
31
39
///
32
40
/// We descend into the RHS (`src`), expanding things as we go. This stack contains the things
@@ -58,14 +66,6 @@ struct TranscrCtx<'psess, 'itp> {
58
66
/// The in-progress `result` lives at the top of this stack. Each entered `TokenTree` adds a
59
67
/// new entry.
60
68
result_stack : Vec < Vec < TokenTree > > ,
61
-
62
- /// Allow marking spans.
63
- marker : Marker ,
64
-
65
- psess : & ' psess ParseSess ,
66
-
67
- /// Map from metavars to matched tokens
68
- interp : & ' itp FxHashMap < MacroRulesNormalizedIdent , NamedMatch > ,
69
69
}
70
70
71
71
impl < ' psess > TranscrCtx < ' psess , ' _ > {
@@ -174,17 +174,17 @@ pub(super) fn transcribe<'a>(
174
174
}
175
175
176
176
let mut tscx = TranscrCtx {
177
+ psess,
178
+ interp,
179
+ marker : Marker { expand_id, transparency, cache : Default :: default ( ) } ,
180
+ repeats : Vec :: new ( ) ,
177
181
stack : smallvec ! [ Frame :: new_delimited(
178
182
src,
179
183
src_span,
180
184
DelimSpacing :: new( Spacing :: Alone , Spacing :: Alone )
181
185
) ] ,
182
- repeats : Vec :: new ( ) ,
183
186
result : Vec :: new ( ) ,
184
187
result_stack : Vec :: new ( ) ,
185
- marker : Marker { expand_id, transparency, cache : Default :: default ( ) } ,
186
- psess,
187
- interp,
188
188
} ;
189
189
190
190
loop {
0 commit comments