diff options
| author | Patrick Walton <[email protected]> | 2011-03-11 10:38:55 -0800 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-03-11 10:39:36 -0800 |
| commit | 336f22db61c6c582b4ef019fcfa739e813668fe1 (patch) | |
| tree | 88b1cf6a2182378e154553c7a8fd2345a56c41ad | |
| parent | Handle resolving to native modules. (diff) | |
| download | rust-336f22db61c6c582b4ef019fcfa739e813668fe1.tar.xz rust-336f22db61c6c582b4ef019fcfa739e813668fe1.zip | |
rustc: Resolve upvars as necessary
| -rw-r--r-- | src/comp/middle/trans.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 936a12f3..47bd63c8 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -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)); |