@@ -2188,8 +2188,10 @@ fn trans_expr_fn(bcx: @block_ctxt, f: ast::_fn, sp: span,
2188
2188
let s = mangle_internal_name_by_path ( ccx, sub_cx. path ) ;
2189
2189
let llfn = decl_internal_cdecl_fn ( ccx. llmod , s, llfnty) ;
2190
2190
2191
- let copying = f. proto == ast:: proto_shared ( ast:: sugar_normal)
2192
- || f. proto == ast:: proto_shared ( ast:: sugar_sexy) ;
2191
+ let copying = alt f. proto {
2192
+ ast:: proto_shared ( _) | ast:: proto_send. { true }
2193
+ ast:: proto_bare. | ast:: proto_block. { false }
2194
+ } ;
2193
2195
let env;
2194
2196
alt f. proto {
2195
2197
ast:: proto_block. | ast:: proto_shared ( _) | ast:: proto_send. {
@@ -2812,6 +2814,7 @@ type generic_info =
2812
2814
tydescs : [ ValueRef ] } ;
2813
2815
2814
2816
tag lval_kind { temporary; owned; owned_imm; }
2817
+ type local_var_result = { val: ValueRef , kind: lval_kind} ;
2815
2818
type lval_result = { bcx : @block_ctxt , val : ValueRef , kind : lval_kind } ;
2816
2819
tag callee_env { obj_env( ValueRef ) ; null_env; is_closure; }
2817
2820
type lval_maybe_callee = { bcx: @block_ctxt,
@@ -2824,6 +2827,10 @@ fn null_env_ptr(bcx: @block_ctxt) -> ValueRef {
2824
2827
C_null ( T_opaque_closure_ptr ( bcx_ccx ( bcx) ) )
2825
2828
}
2826
2829
2830
+ fn lval_from_local_var ( bcx : @block_ctxt , r : local_var_result ) -> lval_result {
2831
+ ret { bcx : bcx, val : r. val , kind : r. kind } ;
2832
+ }
2833
+
2827
2834
fn lval_owned ( bcx : @block_ctxt , val : ValueRef ) -> lval_result {
2828
2835
ret { bcx : bcx, val : val, kind : owned} ;
2829
2836
}
@@ -2893,28 +2900,28 @@ fn lookup_discriminant(lcx: @local_ctxt, vid: ast::def_id) -> ValueRef {
2893
2900
}
2894
2901
}
2895
2902
2896
- fn trans_local_var ( cx : @block_ctxt , def : ast:: def ) -> lval_result {
2897
- fn take_local ( cx : @ block_ctxt , table : hashmap < ast:: node_id , local_val > ,
2898
- id : ast:: node_id ) -> lval_result {
2903
+ fn trans_local_var ( cx : @block_ctxt , def : ast:: def ) -> local_var_result {
2904
+ fn take_local ( table : hashmap < ast:: node_id , local_val > ,
2905
+ id : ast:: node_id ) -> local_var_result {
2899
2906
alt table. find ( id) {
2900
- some ( local_mem ( v) ) { lval_owned ( cx , v ) }
2901
- some ( local_imm ( v) ) { { bcx : cx , val: v, kind: owned_imm} }
2907
+ some ( local_mem ( v) ) { { val : v , kind : owned } }
2908
+ some ( local_imm ( v) ) { { val: v, kind: owned_imm} }
2902
2909
}
2903
2910
}
2904
2911
alt def {
2905
2912
ast : : def_upvar ( did, _, _) {
2906
2913
assert ( cx. fcx . llupvars . contains_key ( did. node ) ) ;
2907
- ret lval_owned ( cx , cx. fcx . llupvars . get ( did. node ) ) ;
2914
+ ret { val : cx. fcx . llupvars . get ( did. node ) , kind : owned } ;
2908
2915
}
2909
2916
ast:: def_arg ( did, _) {
2910
- ret take_local( cx, cx . fcx . llargs , did. node ) ;
2917
+ ret take_local( cx. fcx . llargs , did. node ) ;
2911
2918
}
2912
2919
ast:: def_local ( did, _) | ast:: def_binding ( did) {
2913
- ret take_local ( cx, cx . fcx . lllocals , did. node ) ;
2920
+ ret take_local ( cx. fcx . lllocals , did. node ) ;
2914
2921
}
2915
2922
ast:: def_obj_field ( did, _) {
2916
2923
assert ( cx. fcx . llobjfields . contains_key ( did. node ) ) ;
2917
- ret lval_owned ( cx , cx. fcx . llobjfields . get ( did. node ) ) ;
2924
+ ret { val : cx. fcx . llobjfields . get ( did. node ) , kind : owned } ;
2918
2925
}
2919
2926
_ {
2920
2927
bcx_ccx( cx) . sess . span_unimpl
@@ -2975,7 +2982,7 @@ fn trans_var(cx: @block_ctxt, sp: span, def: ast::def, id: ast::node_id)
2975
2982
}
2976
2983
_ {
2977
2984
let loc = trans_local_var ( cx, def) ;
2978
- ret lval_no_env ( loc . bcx , loc. val , loc. kind ) ;
2985
+ ret lval_no_env ( cx , loc. val , loc. kind ) ;
2979
2986
}
2980
2987
}
2981
2988
}
0 commit comments