Skip to content

Commit e9a6fc9

Browse files
committed
Make collect_upvars know about function args.
Closes #697.
1 parent a3301f7 commit e9a6fc9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/comp/middle/trans.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4086,6 +4086,10 @@ fn collect_upvars(&@block_ctxt cx, &fn (&walk::ast_visitor) walker,
40864086
resolve::def_map def_map,
40874087
session::session sess);
40884088

4089+
fn walk_fn(env e, &ast::_fn f, &ast::ty_param[] tps, &span sp,
4090+
&ast::fn_ident i, ast::node_id nid) {
4091+
for (ast::arg a in f.decl.inputs) { e.decls.insert(a.id, ()); }
4092+
}
40894093
fn walk_expr(env e, &@ast::expr expr) {
40904094
alt (expr.node) {
40914095
case (ast::expr_path(?path)) {
@@ -4123,7 +4127,8 @@ fn collect_upvars(&@block_ctxt cx, &fn (&walk::ast_visitor) walker,
41234127
def_map=cx.fcx.lcx.ccx.tcx.def_map,
41244128
sess=cx.fcx.lcx.ccx.tcx.sess);
41254129
auto visitor =
4126-
@rec(visit_local_pre=bind walk_local(e, _),
4130+
@rec(visit_fn_pre=bind walk_fn(e, _, _, _, _, _),
4131+
visit_local_pre=bind walk_local(e, _),
41274132
visit_expr_pre=bind walk_expr(e, _),
41284133
visit_pat_pre=bind walk_pat(e, _)
41294134
with walk::default_visitor());

0 commit comments

Comments
 (0)