Skip to content

Commit c610d02

Browse files
committed
gather_locals shouldn't descend down into fns and items.
1 parent 7caf8a0 commit c610d02

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/comp/middle/typeck.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,11 +1250,20 @@ fn gather_locals(&@crate_ctxt ccx, &ast::_fn f,
12501250
}
12511251
visit::visit_pat(p, e, v);
12521252
}
1253+
1254+
// Don't descend into fns and items
1255+
fn visit_fn[E](&ast::_fn f, &ast::ty_param[] tp, &span sp,
1256+
&ast::fn_ident i, ast::node_id id, &E e,
1257+
&visit::vt[E] v) {}
1258+
fn visit_item[E](&@ast::item i, &E e, &visit::vt[E] v) {}
1259+
12531260
auto visit =
12541261
@rec(visit_local=bind visit_local(ccx, vb, locals, local_names,
12551262
nvi, _, _, _),
12561263
visit_pat=bind visit_pat(ccx, vb, locals, local_names,
1257-
nvi, _, _, _)
1264+
nvi, _, _, _),
1265+
visit_fn=visit_fn,
1266+
visit_item=visit_item
12581267
with *visit::default_visitor());
12591268
visit::visit_block(f.body, (), visit::mk_vt(visit));
12601269
ret rec(var_bindings=vb,

0 commit comments

Comments
 (0)