Skip to content

Commit 118970c

Browse files
committed
---
yaml --- r: 6691 b: refs/heads/master c: 36177dd h: refs/heads/master i: 6689: b037463 6687: aa69266 v: v3
1 parent fe2f106 commit 118970c

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 7fbca4e31ce51ac4b7cae155780730e1ab2dccb4
2+
refs/heads/master: 36177dd3e986199f4f6cb669423ca9cf78ff8d74

trunk/src/comp/middle/trans.rs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2188,8 +2188,10 @@ fn trans_expr_fn(bcx: @block_ctxt, f: ast::_fn, sp: span,
21882188
let s = mangle_internal_name_by_path(ccx, sub_cx.path);
21892189
let llfn = decl_internal_cdecl_fn(ccx.llmod, s, llfnty);
21902190

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+
};
21932195
let env;
21942196
alt f.proto {
21952197
ast::proto_block. | ast::proto_shared(_) | ast::proto_send. {
@@ -2812,6 +2814,7 @@ type generic_info =
28122814
tydescs: [ValueRef]};
28132815

28142816
tag lval_kind { temporary; owned; owned_imm; }
2817+
type local_var_result = {val: ValueRef, kind: lval_kind};
28152818
type lval_result = {bcx: @block_ctxt, val: ValueRef, kind: lval_kind};
28162819
tag callee_env { obj_env(ValueRef); null_env; is_closure; }
28172820
type lval_maybe_callee = {bcx: @block_ctxt,
@@ -2824,6 +2827,10 @@ fn null_env_ptr(bcx: @block_ctxt) -> ValueRef {
28242827
C_null(T_opaque_closure_ptr(bcx_ccx(bcx)))
28252828
}
28262829

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+
28272834
fn lval_owned(bcx: @block_ctxt, val: ValueRef) -> lval_result {
28282835
ret {bcx: bcx, val: val, kind: owned};
28292836
}
@@ -2893,28 +2900,28 @@ fn lookup_discriminant(lcx: @local_ctxt, vid: ast::def_id) -> ValueRef {
28932900
}
28942901
}
28952902

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 {
28992906
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} }
29022909
}
29032910
}
29042911
alt def {
29052912
ast::def_upvar(did, _, _) {
29062913
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 };
29082915
}
29092916
ast::def_arg(did, _) {
2910-
ret take_local(cx, cx.fcx.llargs, did.node);
2917+
ret take_local(cx.fcx.llargs, did.node);
29112918
}
29122919
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);
29142921
}
29152922
ast::def_obj_field(did, _) {
29162923
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 };
29182925
}
29192926
_ {
29202927
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)
29752982
}
29762983
_ {
29772984
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);
29792986
}
29802987
}
29812988
}

0 commit comments

Comments
 (0)