Remove support for old-style for

Closes #1619
This commit is contained in:
Marijn Haverbeke 2012-04-06 20:36:43 +02:00
parent c902eafa14
commit fc202ca034
21 changed files with 37 additions and 164 deletions

View file

@ -408,7 +408,7 @@ fn resolve_names(e: @env, c: @ast::crate) {
e.sess.abort_if_errors();
fn walk_expr(e: @env, exp: @ast::expr, sc: scopes, v: vt<scopes>) {
visit_expr_with_scope(exp, sc, v);
visit::visit_expr(exp, sc, v);
alt exp.node {
ast::expr_path(p) {
maybe_insert(e, exp.id,
@ -613,18 +613,6 @@ fn visit_arm_with_scope(a: ast::arm, sc: scopes, v: vt<scopes>) {
v.visit_block(a.body, sc_inner, v);
}
fn visit_expr_with_scope(x: @ast::expr, sc: scopes, v: vt<scopes>) {
alt x.node {
ast::expr_for(decl, coll, blk) {
let new_sc = cons(scope_loop(decl), @sc);
v.visit_expr(coll, sc, v);
v.visit_local(decl, new_sc, v);
v.visit_block(blk, new_sc, v);
}
_ { visit::visit_expr(x, sc, v); }
}
}
// This is only for irrefutable patterns (e.g. ones that appear in a let)
// So if x occurs, and x is already known to be a enum, that's always an error
fn visit_local_with_scope(e: @env, loc: @local, sc:scopes, v:vt<scopes>) {