@@ -2646,11 +2646,8 @@ fn check_stmt(&@fn_ctxt fcx, &@ast::stmt stmt) -> @ast::stmt {
2646
2646
fail;
2647
2647
}
2648
2648
2649
- fn check_block ( & @fn_ctxt fcx , & ast:: block block) -> ast:: block {
2650
- let vec[ @ast:: stmt] stmts = [ ] ;
2651
- for ( @ast:: stmt s in block. node. stmts) {
2652
- vec:: push[ @ast:: stmt] ( stmts, check_stmt ( fcx, s) ) ;
2653
- }
2649
+ fn check_block ( & @fn_ctxt fcx , & ast:: block block) {
2650
+ for ( @ast:: stmt s in block. node. stmts) { check_stmt ( fcx, s) ; }
2654
2651
2655
2652
alt ( block. node . expr ) {
2656
2653
case ( none[ @ast:: expr] ) { /* empty */ }
@@ -2661,11 +2658,7 @@ fn check_block(&@fn_ctxt fcx, &ast::block block) -> ast::block {
2661
2658
}
2662
2659
}
2663
2660
2664
- auto new_ann = plain_ann ( block. node . a . id , fcx. ccx . tcx ) ;
2665
2661
write_nil_type ( fcx. ccx . tcx , fcx. ccx . node_types , block. node . a . id ) ;
2666
-
2667
- ret fold:: respan ( block. span ,
2668
- rec ( stmts=stmts, expr=block. node . expr , a=new_ann) ) ;
2669
2662
}
2670
2663
2671
2664
fn check_const ( & @crate_ctxt ccx , & span sp, & ast:: ident ident, & @ast:: ty t,
@@ -2710,7 +2703,7 @@ fn check_fn(&@crate_ctxt ccx, &ast::fn_decl decl, ast::proto proto,
2710
2703
ccx = ccx) ;
2711
2704
2712
2705
// TODO: Make sure the type of the block agrees with the function type.
2713
- auto block_t = check_block( fcx, body) ;
2706
+ check_block( fcx, body) ;
2714
2707
alt ( decl. purity) {
2715
2708
case ( ast:: pure_fn) {
2716
2709
// per the previous comment, this just checks that the declared
@@ -2722,10 +2715,9 @@ fn check_fn(&@crate_ctxt ccx, &ast::fn_decl decl, ast::proto proto,
2722
2715
case ( _) { }
2723
2716
}
2724
2717
2725
- writeback:: resolve_local_types_in_block( fcx, block_t ) ;
2718
+ writeback:: resolve_local_types_in_block( fcx, body ) ;
2726
2719
2727
- auto fn_t = rec( decl=decl, proto=proto, body=block_t) ;
2728
- ret fn_t;
2720
+ ret rec( decl=decl, proto=proto, body=body) ;
2729
2721
}
2730
2722
2731
2723
fn check_item_fn( & @crate_ctxt ccx, & span sp, & ast:: ident ident, & ast:: _fn f,
0 commit comments