Disallow block as a variable name in preparation for it becoming a keyword.
This commit is contained in:
parent
01675f34e0
commit
6bcdb48e35
6 changed files with 48 additions and 47 deletions
|
|
@ -103,11 +103,11 @@ fn visit_expr(&@ctx cx, &@ast::expr ex, &scope sc, &vt[scope] v) {
|
|||
case (_) { }
|
||||
}
|
||||
}
|
||||
ast::expr_for_each(?decl, ?call, ?block) {
|
||||
check_for_each(*cx, decl, call, block, sc, v);
|
||||
ast::expr_for_each(?decl, ?call, ?blk) {
|
||||
check_for_each(*cx, decl, call, blk, sc, v);
|
||||
}
|
||||
ast::expr_for(?decl, ?seq, ?block) {
|
||||
check_for(*cx, decl, seq, block, sc, v);
|
||||
ast::expr_for(?decl, ?seq, ?blk) {
|
||||
check_for(*cx, decl, seq, blk, sc, v);
|
||||
}
|
||||
ast::expr_path(?pt) {
|
||||
check_var(*cx, ex, pt, ex.id, false, sc);
|
||||
|
|
@ -326,7 +326,7 @@ fn arm_defnums(&ast::arm arm) -> node_id[] {
|
|||
}
|
||||
|
||||
fn check_for_each(&ctx cx, &@ast::local local, &@ast::expr call,
|
||||
&ast::block block, &scope sc, &vt[scope] v) {
|
||||
&ast::block blk, &scope sc, &vt[scope] v) {
|
||||
visit::visit_expr(call, sc, v);
|
||||
alt (call.node) {
|
||||
case (ast::expr_call(?f, ?args)) {
|
||||
|
|
@ -339,12 +339,12 @@ fn check_for_each(&ctx cx, &@ast::local local, &@ast::expr call,
|
|||
tys=data.unsafe_ts,
|
||||
depends_on=deps(sc, data.root_vars),
|
||||
mutable ok=valid);
|
||||
visit::visit_block(block, @(*sc + ~[new_sc]), v);
|
||||
visit::visit_block(blk, @(*sc + ~[new_sc]), v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn check_for(&ctx cx, &@ast::local local, &@ast::expr seq, &ast::block block,
|
||||
fn check_for(&ctx cx, &@ast::local local, &@ast::expr seq, &ast::block blk,
|
||||
&scope sc, &vt[scope] v) {
|
||||
visit::visit_expr(seq, sc, v);
|
||||
auto defnum = local.node.id;
|
||||
|
|
@ -374,7 +374,7 @@ fn check_for(&ctx cx, &@ast::local local, &@ast::expr seq, &ast::block block,
|
|||
tys=unsafe,
|
||||
depends_on=deps(sc, root_def),
|
||||
mutable ok=valid);
|
||||
visit::visit_block(block, @(*sc + ~[new_sc]), v);
|
||||
visit::visit_block(blk, @(*sc + ~[new_sc]), v);
|
||||
}
|
||||
|
||||
fn check_var(&ctx cx, &@ast::expr ex, &ast::path p, ast::node_id id,
|
||||
|
|
|
|||
|
|
@ -446,14 +446,14 @@ fn trans_recv(&@block_ctxt bcx, &dest dest, &@ast::expr expr) -> @block_ctxt {
|
|||
ret bcx; // TODO
|
||||
}
|
||||
|
||||
fn trans_block(&@block_ctxt cx, &dest dest, &ast::block block)
|
||||
fn trans_block(&@block_ctxt cx, &dest dest, &ast::block blk)
|
||||
-> @block_ctxt {
|
||||
auto bcx = cx;
|
||||
for each (@ast::local local in trans::block_locals(block)) {
|
||||
for each (@ast::local local in trans::block_locals(blk)) {
|
||||
bcx = trans::alloc_local(bcx, local).bcx;
|
||||
}
|
||||
|
||||
for (@ast::stmt stmt in block.node.stmts) {
|
||||
for (@ast::stmt stmt in blk.node.stmts) {
|
||||
bcx = trans_stmt(bcx, stmt);
|
||||
|
||||
// If we hit a terminator, control won't go any further so
|
||||
|
|
@ -461,7 +461,7 @@ fn trans_block(&@block_ctxt cx, &dest dest, &ast::block block)
|
|||
if trans::is_terminated(bcx) { ret bcx; }
|
||||
}
|
||||
|
||||
alt (block.node.expr) {
|
||||
alt (blk.node.expr) {
|
||||
some(?e) { bcx = trans_expr(bcx, dest, e); }
|
||||
none { /* no-op */ }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1147,7 +1147,7 @@ mod writeback {
|
|||
}
|
||||
fn keep_going(@wb_ctxt wbcx) -> bool { !wbcx.ignore && wbcx.success }
|
||||
|
||||
fn resolve_type_vars_in_block(&@fn_ctxt fcx, &ast::block block) -> bool {
|
||||
fn resolve_type_vars_in_block(&@fn_ctxt fcx, &ast::block blk) -> bool {
|
||||
auto wbcx = @rec(fcx = fcx,
|
||||
mutable ignore = false,
|
||||
mutable success = true);
|
||||
|
|
@ -1163,7 +1163,7 @@ mod writeback {
|
|||
visit_pat_pre=bind visit_pat_pre(wbcx, _),
|
||||
visit_local_pre=bind visit_local_pre(wbcx, _)
|
||||
with walk::default_visitor());
|
||||
walk::walk_block(visit, block);
|
||||
walk::walk_block(visit, blk);
|
||||
ret wbcx.success;
|
||||
}
|
||||
}
|
||||
|
|
@ -2598,14 +2598,14 @@ fn check_stmt(&@fn_ctxt fcx, &@ast::stmt stmt) {
|
|||
write::nil_ty(fcx.ccx.tcx, node_id);
|
||||
}
|
||||
|
||||
fn check_block(&@fn_ctxt fcx, &ast::block block) {
|
||||
for (@ast::stmt s in block.node.stmts) { check_stmt(fcx, s); }
|
||||
alt (block.node.expr) {
|
||||
case (none) { write::nil_ty(fcx.ccx.tcx, block.node.id); }
|
||||
fn check_block(&@fn_ctxt fcx, &ast::block blk) {
|
||||
for (@ast::stmt s in blk.node.stmts) { check_stmt(fcx, s); }
|
||||
alt (blk.node.expr) {
|
||||
case (none) { write::nil_ty(fcx.ccx.tcx, blk.node.id); }
|
||||
case (some(?e)) {
|
||||
check_expr(fcx, e);
|
||||
auto ety = expr_ty(fcx.ccx.tcx, e);
|
||||
write::ty_only_fixup(fcx, block.node.id, ety);
|
||||
write::ty_only_fixup(fcx, blk.node.id, ety);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue