rustc: Resolve upvars as necessary

This commit is contained in:
Patrick Walton 2011-03-11 10:38:55 -08:00
parent 0117cf2fc2
commit 336f22db61
1 changed files with 9 additions and 2 deletions

View File

@ -3338,8 +3338,15 @@ fn trans_path(@block_ctxt cx, &ast.path p, &option.t[ast.def] dopt,
ret lval_mem(cx, cx.fcx.llargs.get(did));
}
case (ast.def_local(?did)) {
check (cx.fcx.lllocals.contains_key(did));
ret lval_mem(cx, cx.fcx.lllocals.get(did));
alt (cx.fcx.lllocals.find(did)) {
case (none[ValueRef]) {
check (cx.fcx.llupvars.contains_key(did));
ret lval_mem(cx, cx.fcx.llupvars.get(did));
}
case (some[ValueRef](?llval)) {
ret lval_mem(cx, llval);
}
}
}
case (ast.def_binding(?did)) {
check (cx.fcx.lllocals.contains_key(did));