@@ -50,7 +50,6 @@ import type_of::type_of; // Issue #1873
50
50
import syntax:: ast_map:: { path, path_mod, path_name} ;
51
51
52
52
import std:: smallintmap;
53
- import option:: is_none;
54
53
55
54
// Destinations
56
55
@@ -1212,8 +1211,7 @@ fn lazily_emit_tydesc_glue(ccx: @crate_ctxt, field: uint,
1212
1211
}
1213
1212
}
1214
1213
1215
- // See [Note-arg-mode]
1216
- fn call_tydesc_glue_full ( ++cx : block , v : ValueRef , tydesc : ValueRef ,
1214
+ fn call_tydesc_glue_full ( cx : block , v : ValueRef , tydesc : ValueRef ,
1217
1215
field : uint , static_ti : option < @tydesc_info > ) {
1218
1216
let _icx = cx. insn_ctxt ( "call_tydesc_glue_full" ) ;
1219
1217
lazily_emit_tydesc_glue ( cx. ccx ( ) , field, static_ti) ;
@@ -1251,9 +1249,8 @@ fn call_tydesc_glue_full(++cx: block, v: ValueRef, tydesc: ValueRef,
1251
1249
C_null ( T_ptr ( T_ptr ( cx. ccx ( ) . tydesc_type ) ) ) , llrawptr] ) ;
1252
1250
}
1253
1251
1254
- // See [Note-arg-mode]
1255
- fn call_tydesc_glue ( ++cx : block , v : ValueRef , t : ty:: t , field : uint )
1256
- -> block {
1252
+ fn call_tydesc_glue ( cx : block , v : ValueRef , t : ty:: t , field : uint ) ->
1253
+ block {
1257
1254
let _icx = cx. insn_ctxt ( "call_tydesc_glue" ) ;
1258
1255
let mut ti = none;
1259
1256
let td = get_tydesc ( cx. ccx ( ) , t, ti) ;
@@ -3127,9 +3124,8 @@ fn body_contains_ret(body: ast::blk) -> bool {
3127
3124
cx. found
3128
3125
}
3129
3126
3130
- // See [Note-arg-mode]
3131
3127
fn trans_call_inner (
3132
- ++ in_cx : block ,
3128
+ in_cx : block ,
3133
3129
call_info : option < node_info > ,
3134
3130
fn_expr_ty : ty:: t ,
3135
3131
ret_ty : ty:: t ,
@@ -3257,8 +3253,8 @@ fn need_invoke(bcx: block) -> bool {
3257
3253
_ { }
3258
3254
}
3259
3255
cur = alt cur. parent {
3260
- some ( next) { next }
3261
- none { ret false; }
3256
+ parent_some ( next) { next }
3257
+ parent_none { ret false; }
3262
3258
}
3263
3259
}
3264
3260
}
@@ -3279,7 +3275,7 @@ fn in_lpad_scope_cx(bcx: block, f: fn(scope_info)) {
3279
3275
loop {
3280
3276
alt bcx. kind {
3281
3277
block_scope ( inf) {
3282
- if inf. cleanups . len ( ) > 0 u || is_none ( bcx. parent ) {
3278
+ if inf. cleanups . len ( ) > 0 u || bcx. parent == parent_none {
3283
3279
f ( inf) ; ret;
3284
3280
}
3285
3281
}
@@ -3488,11 +3484,11 @@ fn add_root_cleanup(bcx: block, scope_id: ast::node_id,
3488
3484
some ( { id, _} ) if id == scope_id { ret bcx_sid; }
3489
3485
_ {
3490
3486
alt bcx_sid. parent {
3491
- none {
3487
+ parent_none {
3492
3488
bcx. tcx ( ) . sess . bug (
3493
3489
#fmt[ "no enclosing scope with id %d" , scope_id] ) ;
3494
3490
}
3495
- some ( bcx_par) { bcx_par }
3491
+ parent_some ( bcx_par) { bcx_par }
3496
3492
}
3497
3493
}
3498
3494
}
@@ -3802,10 +3798,7 @@ fn do_spill(bcx: block, v: ValueRef, t: ty::t) -> ValueRef {
3802
3798
3803
3799
// Since this function does *not* root, it is the caller's responsibility to
3804
3800
// ensure that the referent is pointed to by a root.
3805
- // [Note-arg-mode]
3806
- // ++ mode is temporary, due to how borrowck treats enums. With hope,
3807
- // will go away anyway when we get rid of modes.
3808
- fn do_spill_noroot ( ++cx : block , v : ValueRef ) -> ValueRef {
3801
+ fn do_spill_noroot ( cx : block , v : ValueRef ) -> ValueRef {
3809
3802
let llptr = alloca ( cx, val_ty ( v) ) ;
3810
3803
Store ( cx, v, llptr) ;
3811
3804
ret llptr;
@@ -3987,9 +3980,9 @@ fn trans_break_cont(bcx: block, to_end: bool)
3987
3980
_ { }
3988
3981
}
3989
3982
unwind = alt unwind. parent {
3990
- some ( cx) { cx }
3983
+ parent_some ( cx) { cx }
3991
3984
// This is a return from a loop body block
3992
- none {
3985
+ parent_none {
3993
3986
Store ( bcx, C_bool ( !to_end) , bcx. fcx . llretptr ) ;
3994
3987
cleanup_and_leave ( bcx, none, some ( bcx. fcx . llreturn ) ) ;
3995
3988
Unreachable ( bcx) ;
@@ -4107,7 +4100,7 @@ fn trans_stmt(cx: block, s: ast::stmt) -> block {
4107
4100
4108
4101
// You probably don't want to use this one. See the
4109
4102
// next three functions instead.
4110
- fn new_block ( cx : fn_ctxt , parent : option < block > , +kind : block_kind ,
4103
+ fn new_block ( cx : fn_ctxt , parent : block_parent , +kind : block_kind ,
4111
4104
name : str , opt_node_info : option < node_info > ) -> block {
4112
4105
4113
4106
let s = if cx. ccx . sess . opts . save_temps || cx. ccx . sess . opts . debuginfo {
@@ -4116,10 +4109,19 @@ fn new_block(cx: fn_ctxt, parent: option<block>, +kind: block_kind,
4116
4109
let llbb: BasicBlockRef = str:: as_c_str ( s, { |buf|
4117
4110
llvm:: LLVMAppendBasicBlock ( cx. llfn , buf)
4118
4111
} ) ;
4119
- let bcx = mk_block ( llbb, parent, kind, opt_node_info, cx) ;
4120
- option:: iter ( parent) { |cx|
4112
+ let bcx = @{ llbb: llbb,
4113
+ mut terminated: false ,
4114
+ mut unreachable: false ,
4115
+ parent: parent,
4116
+ kind: kind,
4117
+ node_info: opt_node_info,
4118
+ fcx: cx} ;
4119
+ alt parent {
4120
+ parent_some( cx) {
4121
4121
if cx. unreachable { Unreachable ( bcx) ; }
4122
- } ;
4122
+ }
4123
+ _ { }
4124
+ }
4123
4125
ret bcx;
4124
4126
}
4125
4127
@@ -4130,20 +4132,20 @@ fn simple_block_scope() -> block_kind {
4130
4132
4131
4133
// Use this when you're at the top block of a function or the like.
4132
4134
fn top_scope_block ( fcx : fn_ctxt , opt_node_info : option < node_info > ) -> block {
4133
- ret new_block ( fcx, none , simple_block_scope ( ) ,
4135
+ ret new_block ( fcx, parent_none , simple_block_scope ( ) ,
4134
4136
"function top level" , opt_node_info) ;
4135
4137
}
4136
4138
4137
4139
fn scope_block ( bcx : block ,
4138
4140
opt_node_info : option < node_info > ,
4139
4141
n : str ) -> block {
4140
- ret new_block ( bcx. fcx , some ( bcx) , simple_block_scope ( ) ,
4142
+ ret new_block ( bcx. fcx , parent_some ( bcx) , simple_block_scope ( ) ,
4141
4143
n, opt_node_info) ;
4142
4144
}
4143
4145
4144
4146
fn loop_scope_block ( bcx : block , loop_break : block , n : str ,
4145
4147
opt_node_info : option < node_info > ) -> block {
4146
- ret new_block ( bcx. fcx , some ( bcx) , block_scope ( {
4148
+ ret new_block ( bcx. fcx , parent_some ( bcx) , block_scope ( {
4147
4149
loop_break : some( loop_break) ,
4148
4150
mut cleanups: [ ] ,
4149
4151
mut cleanup_paths: [ ] ,
@@ -4154,11 +4156,17 @@ fn loop_scope_block(bcx: block, loop_break: block, n: str,
4154
4156
4155
4157
// Use this when you're making a general CFG BB within a scope.
4156
4158
fn sub_block ( bcx : block , n : str ) -> block {
4157
- new_block ( bcx. fcx , some ( bcx) , block_non_scope, n, none)
4159
+ ret new_block ( bcx. fcx , parent_some ( bcx) , block_non_scope, n, none) ;
4158
4160
}
4159
4161
4160
4162
fn raw_block ( fcx : fn_ctxt , llbb : BasicBlockRef ) -> block {
4161
- mk_block ( llbb, none, block_non_scope, none, fcx)
4163
+ ret @{ llbb : llbb,
4164
+ mut terminated : false ,
4165
+ mut unreachable : false ,
4166
+ parent : parent_none,
4167
+ kind : block_non_scope,
4168
+ node_info : none,
4169
+ fcx : fcx} ;
4162
4170
}
4163
4171
4164
4172
@@ -4233,8 +4241,8 @@ fn cleanup_and_leave(bcx: block, upto: option<BasicBlockRef>,
4233
4241
_ { }
4234
4242
}
4235
4243
cur = alt cur. parent {
4236
- some ( next) { next }
4237
- none { assert is_none( upto) ; break ; }
4244
+ parent_some ( next) { next }
4245
+ parent_none { assert option :: is_none ( upto) ; break ; }
4238
4246
} ;
4239
4247
}
4240
4248
alt leave {
0 commit comments