@@ -150,7 +150,7 @@ type val_self_pair = rec(ValueRef v, ty::t t);
150
150
type ty_self_pair = tup ( TypeRef , ty:: t ) ;
151
151
152
152
// Function context. Every LLVM function we create will have one of these.
153
- state type fn_ctxt = rec (
153
+ type fn_ctxt = rec (
154
154
// The ValueRef returned from a call to llvm::LLVMAddFunction; the address
155
155
// of the first instruction in the sequence of instructions for this
156
156
// function that will go in the .text section of the executable we're
@@ -305,8 +305,8 @@ tag block_parent {
305
305
}
306
306
307
307
308
- state type result = rec ( mutable @block_ctxt bcx,
309
- mutable ValueRef val) ;
308
+ state type result = rec ( @block_ctxt bcx,
309
+ ValueRef val) ;
310
310
311
311
fn sep ( ) -> str {
312
312
ret "_" ;
@@ -364,8 +364,8 @@ fn mangle_name_by_seq(&@crate_ctxt ccx, &vec[str] path,
364
364
}
365
365
366
366
fn res ( @block_ctxt bcx , ValueRef val) -> result {
367
- ret rec ( mutable bcx = bcx,
368
- mutable val = val) ;
367
+ ret rec ( bcx = bcx,
368
+ val = val) ;
369
369
}
370
370
371
371
fn ty_str ( type_names tn, TypeRef t) -> str {
@@ -2019,7 +2019,7 @@ fn emit_tydescs(&@crate_ctxt ccx) {
2019
2019
2020
2020
auto ti = pair. _1 ;
2021
2021
2022
- auto take_glue = alt ( ti. take_glue ) {
2022
+ auto take_glue = alt ( { ti. take_glue } ) {
2023
2023
case ( none) {
2024
2024
ccx. stats . n_null_glues += 1 u;
2025
2025
C_null ( glue_fn_ty)
@@ -2030,7 +2030,7 @@ fn emit_tydescs(&@crate_ctxt ccx) {
2030
2030
}
2031
2031
} ;
2032
2032
2033
- auto drop_glue = alt ( ti. drop_glue ) {
2033
+ auto drop_glue = alt ( { ti. drop_glue } ) {
2034
2034
case ( none) {
2035
2035
ccx. stats . n_null_glues += 1 u;
2036
2036
C_null ( glue_fn_ty)
@@ -2041,7 +2041,7 @@ fn emit_tydescs(&@crate_ctxt ccx) {
2041
2041
}
2042
2042
} ;
2043
2043
2044
- auto free_glue = alt ( ti. free_glue ) {
2044
+ auto free_glue = alt ( { ti. free_glue } ) {
2045
2045
case ( none) {
2046
2046
ccx. stats . n_null_glues += 1 u;
2047
2047
C_null ( glue_fn_ty)
@@ -2052,7 +2052,7 @@ fn emit_tydescs(&@crate_ctxt ccx) {
2052
2052
}
2053
2053
} ;
2054
2054
2055
- auto cmp_glue = alt ( ti. cmp_glue ) {
2055
+ auto cmp_glue = alt ( { ti. cmp_glue } ) {
2056
2056
case ( none) {
2057
2057
ccx. stats . n_null_glues += 1 u;
2058
2058
C_null ( cmp_fn_ty)
@@ -2998,7 +2998,7 @@ fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
2998
2998
case ( some( ?ti) ) {
2999
2999
3000
3000
if ( field == abi:: tydesc_field_take_glue) {
3001
- alt ( ti. take_glue) {
3001
+ alt ( { ti. take_glue} ) {
3002
3002
case ( some( _) ) { }
3003
3003
case ( none) {
3004
3004
log #fmt( "+++ lazily_emit_tydesc_glue TAKE %s",
@@ -3019,7 +3019,7 @@ fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
3019
3019
}
3020
3020
}
3021
3021
} else if ( field == abi:: tydesc_field_drop_glue) {
3022
- alt ( ti. drop_glue) {
3022
+ alt ( { ti. drop_glue} ) {
3023
3023
case ( some( _) ) { }
3024
3024
case ( none) {
3025
3025
log #fmt( "+++ lazily_emit_tydesc_glue DROP %s",
@@ -3039,7 +3039,7 @@ fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
3039
3039
}
3040
3040
3041
3041
} else if ( field == abi:: tydesc_field_free_glue) {
3042
- alt ( ti. free_glue) {
3042
+ alt ( { ti. free_glue} ) {
3043
3043
case ( some( _) ) { }
3044
3044
case ( none) {
3045
3045
log #fmt( "+++ lazily_emit_tydesc_glue FREE %s",
@@ -3060,7 +3060,7 @@ fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
3060
3060
}
3061
3061
3062
3062
} else if ( field == abi:: tydesc_field_cmp_glue) {
3063
- alt ( ti. cmp_glue) {
3063
+ alt ( { ti. cmp_glue} ) {
3064
3064
case ( some( _) ) { }
3065
3065
case ( none) {
3066
3066
log #fmt( "+++ lazily_emit_tydesc_glue CMP %s",
@@ -3931,7 +3931,7 @@ fn trans_for(&@block_ctxt cx,
3931
3931
fn collect_upvars( & @block_ctxt cx, & ast:: block bloc,
3932
3932
& ast:: def_id initial_decl) -> vec[ ast:: def_id] {
3933
3933
type env = @rec(
3934
- mutable vec[ ast:: def_id] refs,
3934
+ vec[ ast:: def_id] refs,
3935
3935
hashmap[ ast:: def_id, ( ) ] decls,
3936
3936
resolve:: def_map def_map
3937
3937
) ;
@@ -3965,7 +3965,7 @@ fn collect_upvars(&@block_ctxt cx, &ast::block bloc,
3965
3965
let vec[ ast:: def_id] refs = [ ] ;
3966
3966
let hashmap[ ast:: def_id, ( ) ] decls = new_def_hash[ ( ) ] ( ) ;
3967
3967
decls. insert( initial_decl, ( ) ) ;
3968
- let env e = @rec( mutable refs=refs,
3968
+ let env e = @rec( refs=refs,
3969
3969
decls=decls,
3970
3970
def_map=cx. fcx. lcx. ccx. tcx. def_map) ;
3971
3971
@@ -4717,7 +4717,7 @@ fn trans_lval(&@block_ctxt cx, &@ast::expr e) -> lval_result {
4717
4717
ret lval_mem( sub. bcx , val) ;
4718
4718
}
4719
4719
case ( ast:: expr_self_method ( ?ident, ?ann) ) {
4720
- alt ( cx. fcx . llself ) {
4720
+ alt ( { cx. fcx . llself } ) {
4721
4721
case ( some ( ?pair) ) {
4722
4722
auto r = pair. v ;
4723
4723
auto t = pair. t ;
@@ -4765,12 +4765,15 @@ fn trans_cast(&@block_ctxt cx, &@ast::expr e, &ast::ann ann) -> result {
4765
4765
// TODO: native-to-native casts
4766
4766
if ( ty:: type_is_native ( cx. fcx . lcx . ccx . tcx ,
4767
4767
ty:: expr_ty ( cx. fcx . lcx . ccx . tcx , e) ) ) {
4768
- e_res. val = e_res. bcx . build . PtrToInt ( e_res. val , lldsttype) ;
4768
+ e_res = res ( e_res. bcx ,
4769
+ e_res. bcx . build . PtrToInt ( e_res. val , lldsttype) ) ;
4769
4770
} else if ( ty:: type_is_native ( cx. fcx . lcx . ccx . tcx , t) ) {
4770
- e_res. val = e_res. bcx . build . IntToPtr ( e_res. val , lldsttype) ;
4771
+ e_res = res ( e_res. bcx ,
4772
+ e_res. bcx . build . IntToPtr ( e_res. val , lldsttype) ) ;
4771
4773
} else {
4772
- e_res. val = int_cast ( e_res. bcx , lldsttype, llsrctype, e_res. val ,
4773
- ty:: type_is_signed ( cx. fcx . lcx . ccx . tcx , t) ) ;
4774
+ e_res = res ( e_res. bcx ,
4775
+ int_cast ( e_res. bcx , lldsttype, llsrctype, e_res. val ,
4776
+ ty:: type_is_signed ( cx. fcx . lcx . ccx . tcx , t) ) ) ;
4774
4777
}
4775
4778
} else {
4776
4779
cx. fcx . lcx . ccx . sess . unimpl ( "fp cast" ) ;
@@ -5767,7 +5770,7 @@ fn with_out_method(fn(&out_method) -> result work, &@block_ctxt cx,
5767
5770
find_scope_cx( cx) . cleanups += [ clean( cleanup) ] ;
5768
5771
5769
5772
auto done = work( save_in( res_alloca. val) ) ;
5770
- done. val = load_if_immediate( done. bcx, res_alloca. val, tp) ;
5773
+ done = res ( done . bcx , load_if_immediate( done. bcx, res_alloca. val, tp) ) ;
5771
5774
ret done;
5772
5775
}
5773
5776
}
@@ -5932,7 +5935,7 @@ fn trans_put(&@block_ctxt cx, &option::t[@ast::expr] e) -> result {
5932
5935
auto llcallee = C_nil ( ) ;
5933
5936
auto llenv = C_nil ( ) ;
5934
5937
5935
- alt ( cx. fcx. lliterbody) {
5938
+ alt ( { cx. fcx. lliterbody} ) {
5936
5939
case ( some( ?lli) ) {
5937
5940
auto slot = alloca( cx, val_ty( lli) ) ;
5938
5941
cx. build. Store ( lli, slot) ;
@@ -5971,7 +5974,7 @@ fn trans_break_cont(&@block_ctxt cx, bool to_end) -> result {
5971
5974
auto cleanup_cx = cx;
5972
5975
while ( true) {
5973
5976
bcx = trans_block_cleanups( bcx, cleanup_cx) ;
5974
- alt ( cleanup_cx. kind) {
5977
+ alt ( { cleanup_cx. kind} ) {
5975
5978
case ( LOOP_SCOPE_BLOCK ( ?_cont, ?_break) ) {
5976
5979
if ( to_end) {
5977
5980
bcx. build. Br ( _break. llbb) ;
@@ -5989,7 +5992,7 @@ fn trans_break_cont(&@block_ctxt cx, bool to_end) -> result {
5989
5992
C_nil ( ) ) ;
5990
5993
}
5991
5994
case ( _) {
5992
- alt ( cleanup_cx. parent) {
5995
+ alt ( { cleanup_cx. parent} ) {
5993
5996
case ( parent_some( ?cx) ) { cleanup_cx = cx; }
5994
5997
}
5995
5998
}
@@ -6033,7 +6036,7 @@ fn trans_ret(&@block_ctxt cx, &option::t[@ast::expr] e) -> result {
6033
6036
auto cleanup_cx = cx;
6034
6037
while ( more_cleanups) {
6035
6038
bcx = trans_block_cleanups( bcx, cleanup_cx) ;
6036
- alt ( cleanup_cx. parent) {
6039
+ alt ( { cleanup_cx. parent} ) {
6037
6040
case ( parent_some( ?b) ) {
6038
6041
cleanup_cx = b;
6039
6042
}
@@ -6831,7 +6834,7 @@ fn copy_any_self_to_alloca(@fn_ctxt fcx,
6831
6834
6832
6835
auto bcx = llallocas_block_ctxt ( fcx) ;
6833
6836
6834
- alt ( fcx. llself ) {
6837
+ alt ( { fcx. llself } ) {
6835
6838
case ( some ( ?pair) ) {
6836
6839
alt ( ty_self) {
6837
6840
case ( some[ ty_self_pair] ( ?tt) ) {
@@ -7000,7 +7003,7 @@ fn trans_fn(@local_ctxt cx, &span sp, &ast::_fn f, ast::def_id fid,
7000
7003
7001
7004
copy_any_self_to_alloca( fcx, ty_self) ;
7002
7005
7003
- alt ( fcx. llself) {
7006
+ alt ( { fcx. llself} ) {
7004
7007
case ( some( ?llself) ) {
7005
7008
populate_fn_ctxt_from_llself( fcx, llself) ;
7006
7009
}
0 commit comments