Skip to content

Commit a4feaad

Browse files
committed
---
yaml --- r: 4061 b: refs/heads/master c: a0a2cee h: refs/heads/master i: 4059: 0474a12 v: v3
1 parent 57a57b8 commit a4feaad

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
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: 4170390cb6cd26e7491968b4383b0e93317ec112
2+
refs/heads/master: a0a2cee8960d67eb0e901d09bd34c504ef3e699b

trunk/src/comp/middle/trans.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3793,7 +3793,7 @@ fn find_variable(&@fn_ctxt fcx, ast::node_id nid) -> ValueRef {
37933793
// contains pointers to all of the upvars and all of the tydescs in
37943794
// scope. Return the ValueRef and TypeRef corresponding to the closure.
37953795
fn build_environment(&@block_ctxt cx, &ast::node_id[] upvars) ->
3796-
tup(ValueRef, TypeRef) {
3796+
rec(ValueRef ptr, TypeRef ptrty) {
37973797
auto upvar_count = std::ivec::len(upvars);
37983798
auto has_iterbody = !option::is_none(cx.fcx.lliterbody);
37993799
if (has_iterbody) { upvar_count += 1u; }
@@ -3852,7 +3852,7 @@ fn build_environment(&@block_ctxt cx, &ast::node_id[] upvars) ->
38523852
i += 1u;
38533853
}
38543854

3855-
ret tup(llenvptr, llenvptrty);
3855+
ret rec(ptr=llenvptr, ptrty=llenvptrty);
38563856
}
38573857

38583858
// Given an enclosing block context, a new function context, a closure type,
@@ -3943,9 +3943,7 @@ fn trans_for_each(&@block_ctxt cx, &@ast::local local, &@ast::expr seq,
39433943
auto decl_id = local.node.id;
39443944
auto upvars = get_freevars(lcx.ccx.tcx, body.node.id);
39453945

3946-
auto environment_data = build_environment(cx, *upvars);
3947-
auto llenvptr = environment_data._0;
3948-
auto llenvptrty = environment_data._1;
3946+
auto llenv = build_environment(cx, *upvars);
39493947

39503948
// Step 2: Declare foreach body function.
39513949
let str s =
@@ -3966,7 +3964,7 @@ fn trans_for_each(&@block_ctxt cx, &@ast::local local, &@ast::expr seq,
39663964

39673965
// Generate code to load the environment out of the
39683966
// environment pointer.
3969-
load_environment(cx, fcx, llenvptrty, *upvars);
3967+
load_environment(cx, fcx, llenv.ptrty, *upvars);
39703968

39713969
// Add an upvar for the loop variable alias.
39723970
fcx.llupvars.insert(decl_id, llvm::LLVMGetParam(fcx.llfn, 3u));
@@ -3984,7 +3982,7 @@ fn trans_for_each(&@block_ctxt cx, &@ast::local local, &@ast::expr seq,
39843982
alt (seq.node) {
39853983
case (ast::expr_call(?f, ?args)) {
39863984
auto pair = create_real_fn_pair(cx, iter_body_llty,
3987-
lliterbody, llenvptr);
3985+
lliterbody, llenv.ptr);
39883986
r = trans_call(cx, f, some[ValueRef](cx.build.Load(pair)),
39893987
args, seq.id);
39903988
ret rslt(r.bcx, C_nil());

0 commit comments

Comments
 (0)