@@ -72,11 +72,11 @@ struct ReadyCtx {
72
72
sess : session:: Session ,
73
73
crate : @ast : : crate ,
74
74
ext_cx : ext_ctxt ,
75
- mut path : ~[ ast:: ident ] ,
76
- mut fns : ~[ ListenerFn ]
75
+ path : ~[ ast:: ident ] ,
76
+ fns : ~[ ListenerFn ]
77
77
}
78
78
79
- fn fold_mod ( _ctx : @ReadyCtx , m : ast:: _mod ,
79
+ fn fold_mod ( _ctx : @mut ReadyCtx , m : ast:: _mod ,
80
80
fold : fold:: ast_fold ) -> ast:: _mod {
81
81
fn strip_main ( item : @ast:: item ) -> @ast:: item {
82
82
@ast:: item {
@@ -95,7 +95,7 @@ fn fold_mod(_ctx: @ReadyCtx, m: ast::_mod,
95
95
} , fold)
96
96
}
97
97
98
- fn fold_item ( ctx : @ReadyCtx , item : @ast:: item ,
98
+ fn fold_item ( ctx : @mut ReadyCtx , item : @ast:: item ,
99
99
fold : fold:: ast_fold ) -> Option < @ast:: item > {
100
100
101
101
ctx. path . push ( item. ident ) ;
@@ -133,7 +133,7 @@ fn fold_item(ctx: @ReadyCtx, item: @ast::item,
133
133
res
134
134
}
135
135
136
- fn add_pkg_module ( ctx : @ReadyCtx , m : ast:: _mod ) -> ast:: _mod {
136
+ fn add_pkg_module ( ctx : @mut ReadyCtx , m : ast:: _mod ) -> ast:: _mod {
137
137
let listeners = mk_listener_vec ( ctx) ;
138
138
let ext_cx = ctx. ext_cx ;
139
139
let item = quote_item ! (
@@ -152,24 +152,25 @@ fn add_pkg_module(ctx: @ReadyCtx, m: ast::_mod) -> ast::_mod {
152
152
}
153
153
}
154
154
155
- fn mk_listener_vec ( ctx : @ReadyCtx ) -> @ast:: expr {
155
+ fn mk_listener_vec ( ctx : @mut ReadyCtx ) -> @ast:: expr {
156
156
let fns = ctx. fns ;
157
157
let descs = do fns. map |listener| {
158
158
mk_listener_rec ( ctx, * listener)
159
159
} ;
160
- build:: mk_slice_vec_e ( ctx. ext_cx , dummy_sp ( ) , descs)
160
+ let ext_cx = ctx. ext_cx ;
161
+ build:: mk_slice_vec_e ( ext_cx, dummy_sp ( ) , descs)
161
162
}
162
163
163
- fn mk_listener_rec ( ctx : @ReadyCtx , listener : ListenerFn ) -> @ast:: expr {
164
-
164
+ fn mk_listener_rec ( ctx : @mut ReadyCtx , listener : ListenerFn ) -> @ast:: expr {
165
165
let span = listener. span ;
166
166
let cmds = do listener. cmds . map |& cmd| {
167
- build:: mk_base_str ( ctx. ext_cx , span, cmd)
167
+ let ext_cx = ctx. ext_cx ;
168
+ build:: mk_base_str ( ext_cx, span, cmd)
168
169
} ;
169
170
170
- let cmds_expr = build:: mk_slice_vec_e ( ctx. ext_cx , span, cmds) ;
171
- let cb_expr = build:: mk_path ( ctx. ext_cx , span, copy listener. path ) ;
172
171
let ext_cx = ctx. ext_cx ;
172
+ let cmds_expr = build:: mk_slice_vec_e ( ext_cx, span, cmds) ;
173
+ let cb_expr = build:: mk_path ( ext_cx, span, copy listener. path ) ;
173
174
174
175
quote_expr ! (
175
176
Listener {
@@ -182,12 +183,12 @@ fn mk_listener_rec(ctx: @ReadyCtx, listener: ListenerFn) -> @ast::expr {
182
183
/// Generate/filter main function, add the list of commands, etc.
183
184
pub fn ready_crate ( sess : session:: Session ,
184
185
crate : @ast:: crate ) -> @ast:: crate {
185
- let ctx = @ReadyCtx {
186
+ let ctx = @mut ReadyCtx {
186
187
sess : sess,
187
188
crate: crate ,
188
189
ext_cx : mk_ctxt ( sess. parse_sess , copy sess. opts . cfg ) ,
189
- mut path : ~[ ] ,
190
- mut fns : ~[ ]
190
+ path : ~[ ] ,
191
+ fns : ~[ ]
191
192
} ;
192
193
let precursor = @fold:: AstFoldFns {
193
194
// fold_crate: fold::wrap(|a, b| fold_crate(ctx, a, b)),
0 commit comments