@@ -141,6 +141,18 @@ fn mk_block(cx: ext_ctxt, sp: span,
141
141
span: sp } ;
142
142
mk_expr ( cx, sp, ast:: expr_block ( blk) )
143
143
}
144
+ fn mk_block_ ( cx : ext_ctxt , sp : span , +stmts : ~[ @ast:: stmt ] ) -> ast:: blk {
145
+ {
146
+ node : {
147
+ view_items : ~[ ] ,
148
+ stmts : move stmts,
149
+ expr : None ,
150
+ id : cx. next_id ( ) ,
151
+ rules : ast:: default_blk
152
+ } ,
153
+ span: sp
154
+ }
155
+ }
144
156
fn mk_simple_block ( cx : ext_ctxt , span : span , expr : @ast:: expr ) -> ast:: blk {
145
157
let block = {
146
158
view_items: ~[ ] ,
@@ -177,4 +189,39 @@ fn mk_bool(cx: ext_ctxt, span: span, value: bool) -> @ast::expr {
177
189
let lit_expr = ast:: expr_lit ( @{ node: ast:: lit_bool ( value) , span: span } ) ;
178
190
build:: mk_expr ( cx, span, move lit_expr)
179
191
}
192
+ fn mk_stmt ( cx : ext_ctxt , span : span , expr : @ast:: expr ) -> @ast:: stmt {
193
+ let stmt_ = ast:: stmt_semi ( expr, cx. next_id ( ) ) ;
194
+ @{ node: move stmt_, span: span }
195
+ }
196
+ fn mk_ty_path ( cx : ext_ctxt ,
197
+ span : span ,
198
+ idents : ~[ ast:: ident ] )
199
+ -> @ast:: Ty {
200
+ let ty = build:: mk_raw_path ( span, idents) ;
201
+ let ty = ast:: ty_path ( ty, cx. next_id ( ) ) ;
202
+ let ty = @{ id: cx. next_id ( ) , node: move ty, span: span } ;
203
+ ty
204
+ }
205
+ fn mk_simple_ty_path ( cx : ext_ctxt ,
206
+ span : span ,
207
+ ident : ast:: ident )
208
+ -> @ast:: Ty {
209
+ mk_ty_path ( cx, span, ~[ ident ] )
210
+ }
211
+ fn mk_arg ( cx : ext_ctxt ,
212
+ span : span ,
213
+ ident : ast:: ident ,
214
+ ty : @ast:: Ty )
215
+ -> ast:: arg {
216
+ let arg_pat = mk_pat_ident ( cx, span, ident) ;
217
+ {
218
+ mode: ast:: infer ( cx. next_id ( ) ) ,
219
+ ty: ty,
220
+ pat: arg_pat,
221
+ id: cx. next_id ( )
222
+ }
223
+ }
224
+ fn mk_fn_decl ( +inputs : ~[ ast:: arg ] , output : @ast:: Ty ) -> ast:: fn_decl {
225
+ { inputs: move inputs, output: output, cf: ast:: return_val }
226
+ }
180
227
0 commit comments